Hello,
is there a way to get the return message of a mySQL- and a MSSQL-Server after Execute if there is a failure in the statement?
For example the message "You have a syntax error near...".
Thank you for your help.
Kind regards
Andreas
SQL-Server Messages
Hello,
You can use this code:
You can use this code:
Code: Select all
try
UniQuery.Open;
except
on E: EUniError do begin
ShowMessage(E.Message);
end;
end;
You can check the RowsAffected property of a query as follows (from help):
Returns the number of rows operated upon by the latest query execution.
Inspect RowsAffected to determine how many rows were updated or deleted by the last query operation. If no rows were updated or deleted, RowsAffected has a value of zero. RowsAffected will have a value of –1 if the execution of the SQL statement could not be executed due to an error condition. This latter situation would typically follow the raising of an exception.
Regards, Paul.
Returns the number of rows operated upon by the latest query execution.
Inspect RowsAffected to determine how many rows were updated or deleted by the last query operation. If no rows were updated or deleted, RowsAffected has a value of zero. RowsAffected will have a value of –1 if the execution of the SQL statement could not be executed due to an error condition. This latter situation would typically follow the raising of an exception.
Regards, Paul.