0
Guys, does anyone know how to get sql executed in the POST of a query in Insert mode? For example, I have the student table with id and name:
begin
tblAluno.Insert;
tblAlunoID.asInteger := 1;
tblAlunoNome.asString := 'Carlos';
//aqui
tblAluno.Post;
end;
Just in "here" I want to get the sql that runs underneath with Insert. Note that if I put: Clipboard.astext := tblAluno.sql.Text it returns me the query sql and not what actually ran in the post.
Brother @dennis90, had tried this: Showmessage(Zquery1.UpdateObject.Insertsql.Text); Showmessage(Zquery1.UpdateObject.SQL[ukInsert]. Text); 1.UpdateObject. SQL[ukInsert]. Text); E memory error occurs when accessing the property.
– Jack
there is some component defined in the Updateobject property of zquery?
– Dennis
In the Updateobject property there is no component. But in the Updatemode property it is like: umUpdateChanged
– Jack
If I put a Tzupdatesql object in the query works, it accesses the Updateobject.Insertsql property, but it shows it with the unfilled parameters: update table set field1 = :value. I need to access sql without the update component and before the post with the fields filled.
– Jack
I edited the message, check the new code added.
– Dennis
beauty, it is still a solution, but imagine if you have a query with more than 20 fields, I will need to take the Clipboard and replace parameter by parameter in sql for ai yes run in ibexpert until I find the error. Not to mention that this code only works if the query is linked to a Zupdatesql component, otherwise I will gain an Exception.
– Jack
Friend, sorry for the delay in answering, but if you have any error in the query and you do not have componentne Updatesql assigned, this error will not be by query SQL, try to rephrase the question with the error you are facing that we will try to help.
– Dennis
Well @dennis90, I have no error, I only need the sql of Insert that runs when I do the post as I mentioned in the question up there. And I don’t have an updateSQL component connected to the query.
– Jack
That’s why the Querytable standard of Delphi is very good, because it mounts the 4 queries for you. Pity that does not have that in Zeos.
– Please_Dont_Bully_Me_SO_Lords