Params before SQL
Moderators: gto, cipto_kh, EgonHugeist
Params before SQL
Is it possible to create and set value of a param BEFORE setting value of a ZQuery's SQL statement what contains that param?
Last edited by trob on 20.03.2007, 02:44, edited 1 time in total.
In Delphi if i set ParamCheck to False, and run this:
...
DataMod.ZQexec.Params.CreateParam(ftBlob,'kep',ptInput);
DataMod.ZQexec.Params.ParamByName('kep').AsBlob:=kepstream.DataString;
...
UPDATE gyerek SET fenykep=:kep WHERE ...
...
Then it tells me:
Project Vasgyuro.exe raised exception class EZSQLException with message 'SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':kep WHERE ...' at line 1'
So i think that it doesn't assign SQL's :kep to paramlist's kep.
Could You help me?
...
DataMod.ZQexec.Params.CreateParam(ftBlob,'kep',ptInput);
DataMod.ZQexec.Params.ParamByName('kep').AsBlob:=kepstream.DataString;
...
UPDATE gyerek SET fenykep=:kep WHERE ...
...
Then it tells me:
Project Vasgyuro.exe raised exception class EZSQLException with message 'SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':kep WHERE ...' at line 1'
So i think that it doesn't assign SQL's :kep to paramlist's kep.
Could You help me?
hello,
Fist of all, set the SQL.Text, and set the parameters, after call ExecSQL command on your TZQuery object.
IN this way you do not need to call CreateParam() just you sould set the values...
.... BUT on MYSQL I have problems to save BLOB fields into the DB.
Fist of all, set the SQL.Text, and set the parameters, after call ExecSQL command on your TZQuery object.
IN this way you do not need to call CreateParam() just you sould set the values...
.... BUT on MYSQL I have problems to save BLOB fields into the DB.
Code: Select all
DM.iCsoportok.SQL.Text:='INSERT ... ';
DM.iCsoportok.ParamByName('NEV').AsString:=Self.Name;
DM.iCsoportok.ParamByName('LEIRAS').AsString:=Self.Leiras;
DM.iCsoportok.ParamByName('USERID').AsString:=UserID;
DM.iCsoportok.ParamByName('FUNKCIO').AsInteger:=Ord(Self.Funkcio);
DM.iCsoportok.ParamByName('IDO').AsDateTime:=Now();
DM.iCsoportok.ExecSQL;
try to create a function which set the Params object!trob wrote:I can save Blob without any problem.
I would like to set the parameter BEFORE setting SQL.Text, because there is an 'If' for UPDATE and INSERT, but their parameter is the same.
But it seems to be impossible...
procedure setXXXParams(Params:TParams);
begin
....
Params.ParamByName('kep').AsBlob:=kepstream.DataString;
end;