Page 1 of 1

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

Posted: Fri 23 Sep 2005 12:28
by mhanefitel
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.

Posted: Mon 26 Sep 2005 11:29
by Ikar
If SQL contains error then you'll get exception on Execute.
To get count of updated records use RowsAffected property