Hi,
I use dbExpress with dbxida(2.2) with TSQLQuery. When I create prepared query and set it to prepare, after first call ExecSQL my TSQLQuery chages its Prepared status to False.
I tried change CQLConnection param Prepared, but without success.
Can anybody tell me what to do to save Prepared state?
var
QInsert:TSQLQuery;
S: String;
I:Integer;
begin
S := 'insert into PERSONS ('+
' PERSONNUM1'+
', PERSONNUM'+
') values ('+
' :PERSONNUM1' +
', :PERSONNUM'+
')';
if not Assigned(QInsert) then
begin
QInsert:= TSQLQuery.Create(nil);
QInsert.SQLConnection:=con1;
con1.Params.Values['Prepared'] := 'True'; //do nothing
QInsert.SQL.Add(S);
QInsert.Prepared:= True;
end;
for I := -1 downto -3 do
begin
QInsert.ParamByName('PERSONNUM1').AsInteger:= I;
QInsert.ParamByName('PERSONNUM').AsString:= 'xxx'+ InttoStr(I);
QInsert.ExecSQL; // after first execute sets prepare to false
end;
Thanks-