Hi, working with database when I get an error because of a wrong sql query I would like to save the SQL statement which caused the exception, using Delphi 7 and Firebird. How could I get it? thank you very much!
Thank you for your posts, I would need a general solution, because it's a big project with a lot of querys, i use a tool to catch the exception but i don't know how could I get the last sql statement which caused the exception
I use a function to run my SQL. You could add some error trapping code and display the sSQL parameter value in the try..except block.
Code:
procedure TdmDB.RunGeneralQuery(sSQL: string; IsSelect: boolean = false);
begin
with ADOQuery do
begin
close;
sql.clear;
sql.add(sSQL);
if IsSelect then
Open
else
ExecSQL;
end;
end;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.