Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-05

Params in ZeosDBO not working

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

dayat

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.

Thanks
Hidayat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20090515/41c69657/attachment-0001.html>

Reply by email

zeljko
to dayat
dayat wrote 14 lines
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;

Reply by email

dayat
to zeljko

Thanks Zeljko, but I have some code which have a bit defferent than you. I'm adding SQL sintax on design time in Script property of TZSQLProcessor. By example I write the code like:

procedure MyDataInsert(myData: TRecSomeData;  QRY: TZQuery);
begin
  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;

Seems lazarus can't solve in design time. But my wrong or lazarus?

zeljko wrote 44 lines
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; _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20090516/b25eab32/attachment.html>

Reply by email

zeljko
to dayat
dayat wrote
Thanks Zeljko, but I have some code which have a bit defferent than you. I'm adding SQL sintax on design time in Script property of TZSQLProcessor. By example I write the code like:

I don't use TZSQLProcessor ... so cannot help you.

zeljko

Reply by email

Joost van der Sluis
to dayat: I'm using fpc 2.2.4, lazarus 0.9.26.2, zeosdbo 6.6.3-stable. I'm executing sql commands…

Op vrijdag 15-05-2009 om 15:32 uur [tijdzone +0700], schreef dayat:

Show quoted text 5 lines
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.

Maybe you can better ask on the ZEOS-forum

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 +");".

That is normal. A parameter is not something that is replaced by the client with something else, it's send seperately to the server.

Joost.

Reply by email