[solved] Value in the insert ZQuery
Moderators: gto, EgonHugeist, olehs
[solved] Value in the insert ZQuery
How to get the value in the insert ZQuery, sends to the database?
Edson
Edson
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
elidorio2,
Edson, i do not understand what you mean ): !
Some more details?
Michael
Edson, i do not understand what you mean ): !
Some more details?
Michael
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Hello elidorio2
Use the ParamByName to retrieve the value setted up to parameters of TZQuery. Example:
Bye, bye
Josimar
Use the ParamByName to retrieve the value setted up to parameters of TZQuery. Example:
Code: Select all
var
I: Integer;
begin
ZQuery1.ParamByName('col1').AsInteger := 9;
I := ZQuery1.ParamByName('col1').AsInteger;
{...}
end;
Josimar
Though our language is Portuguese, I suggest using English for what others may benefit from the information.
For your case I suggest using the TZSQLMonitor component. Just add it to your project, preferably in the same place the TZConnection component.
Change the TZSQLMonitor Active property to True and encode the event OnLogTrace to get the SQL that was sent to the database from Event.Message
I hope this helps.
For your case I suggest using the TZSQLMonitor component. Just add it to your project, preferably in the same place the TZConnection component.
Change the TZSQLMonitor Active property to True and encode the event OnLogTrace to get the SQL that was sent to the database from Event.Message
I hope this helps.
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
elidorio2,
i think josimarz, is right here. One hint from me:
Your
should be:
then you can use
Also can you execute:
This should speed up the Paramerters IF the Plain drivers do support Real Prepared statements. (for MySQL you need to set TZQuery.Options := [doPreferePreparedResolver...])
Michael
i think josimarz, is right here. One hint from me:
Your
Code: Select all
insert into t1 values (: col1,: col2,: col3,: col4);
Code: Select all
insert into t1 values (:col1, :col2, :col3, :col4);
Code: Select all
ZQuery.ParamByName('col1').AsString(what ever) := 'Your value';
ZQuery.ParamByName('col2').AsString := 'Your second value';
.....
Code: Select all
ZQuery.SQL.Text := 'insert into t1 values (:col1, :col2, :col3, :col4);'
ZQuery.Prepare;
ZQuery.ParamByName('col1').AsString(what ever) := 'Your value';
ZQuery.ParamByName('col2').AsString := 'Your second value';
....
ZQuery.ExecSQL;
ZQuery.ParamByName('col1').AsString(what ever) := 'Your value';
ZQuery.ParamByName('col2').AsString := 'Your second value';
....
ZQuery.ExecSQL;
ZQuery.ParamByName('col1').AsString(what ever) := 'Your value';
ZQuery.ParamByName('col2').AsString := 'Your second value';
....
ZQuery.ExecSQL;
ZQuery.Unprepare;
Michael
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/