How to get MSSQL Server Return Status in Delphi after executing SQL commands.

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mhanefitel
Posts: 7
Joined: Fri 23 Sep 2005 12:26

How to get MSSQL Server Return Status in Delphi after executing SQL commands.

Post by mhanefitel » Fri 23 Sep 2005 12:28

Hi,

I am using MSSQL server 2000 and delphi 7. I am accessing to the database using SDAC components.(SQL Server Direct Access Components)


procedure TFrmAccount.BtnSaveClick(Sender: TObject);
begin
DataModule1.QrTemp.SQL.Text := 'Insert into TabCustomer Values ('+Chr(39)+ Trim(txtAccountNo.Text) + Chr(39)+ ')';
DataModule1.QrTemp.Execute;
end;

How can i get the return status of this Query in Delphi. I need to know the query executed correctly or not.
Thanks in advance.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 26 Sep 2005 11:29

If SQL contains error then you'll get exception on Execute.
To get count of updated records use RowsAffected property

Post Reply