Page 1 of 1

query.ParamByName

Posted: Fri 03 Oct 2014 10:25
by paweld
Hi,
msquery.sql.text:

Code: Select all

update table_master set date=:pdate where id_master=:pid;
update table_details set date=:pdate where id_master=:pid
When i try:

Code: Select all

msquery.ParamByName('pdate').AsDateTime:=Now;
msquery.ParamByName('pid').AsInteger:=1;
msquery.ExecSQL
then only first update execute ok. In the second update all parameters values are NULL.

Lazarus 1.2.4 + FPC 2.6.4, tested on MSSQL 2008 r2 and above

Re: query.ParamByName

Posted: Mon 06 Oct 2014 12:07
by azyk
Thank you for the information. We have reproduced the problem and will investigate it.

Re: query.ParamByName

Posted: Tue 17 Feb 2015 12:17
by paweld
Hi,
Did you can solve the problem?

Re: query.ParamByName

Posted: Thu 19 Feb 2015 09:47
by azyk
When you are using several parameters with identical names in a SQL query, Lazarus will access only one parameter with this name when calling parameters by name. At this, the last parameter with this name in the query will be accessed. Such behavior is a specificity of Lazarus, and we can't affect this.