I have a TClientDataSet connected to a TDataSetProvider, which in turn is connected to a TAdsQuery. I set the SQL command and then open the ClientDataset something like this:
try
CDS.CommandText := 'SELECT * FROM tablename WHERE fieldname = 1';
CDS.Open
except
// trap exception here - this never gets executed!
end;
If the SQL statement in CommandText fails, however (syntax error or whatever) I get an exception within the Advantage code, but it never gets caught in my own exception handling code.
Is there any way for me to trap this error and report it nicely to the user. Alternatively is there a way to verify the syntax of an SQL query before executing it?
I'm using Delphi Pro 2009, and Advantage Local Server 9.