[Lazarus] Params in ZeosDBO not working

zeljko zeljko at holobit.net
Fri May 15 18:38:53 CEST 2009


On Friday 15 May 2009 10:32, dayat wrote:
> Hi,
>
> I'm using fpc 2.2.4, lazarus 0.9.26.2, zeosdbo 6.6.3-stable. I'm executing
> sql commands in TZSQLProcessor using params for changing the values. The
> sql sintax like "INSERT INTO TABLE1 VALUES(:PAR1, :PAR2);". The property of
> ParamCheck filled with the True value, and when I executing the sql I'm got
> the error. After checking, I found that values in SQL sintax can't to
> change, the sql sintax still such "INSERT INTO TABLE1 VALUES(:PAR1,
>
> :PAR2);". Finally I must executing manually such "INSERT INTO TABLE1
>
> VALUES(" + edit1.text +","+ edit2.text +");".
>
> Has anyone have a problem like me.

no :)

procedure MyDataInsert(myData: TRecSomeData;  QRY: TZQuery);
begin
  Qry.Sql.Clear;
  Qry.Params.Clear;
  Qry.Sql.Add('INSERT INTO mytable VALUES(:P1,:P2,:P3,:P4)');
  Qry.Params[0].AsInteger := myData.Index;
  Qry.Params[1].AsString := myData.Name;
  Qry.Params[2].AsFloat := myData.Value;
  Qry.Params[3].AsBoolean := myData.ItWorksForMe;
  try
    Qry.ExecSQL;
    Qry.Connection.Commit;
  except
   .... use your imagination
  end;
end;





More information about the Lazarus mailing list