query.ParamByName

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
paweld
Posts: 11
Joined: Mon 29 Sep 2014 08:56

query.ParamByName

Post by paweld » Fri 03 Oct 2014 10:25

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

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: query.ParamByName

Post by azyk » Mon 06 Oct 2014 12:07

Thank you for the information. We have reproduced the problem and will investigate it.

paweld
Posts: 11
Joined: Mon 29 Sep 2014 08:56

Re: query.ParamByName

Post by paweld » Tue 17 Feb 2015 12:17

Hi,
Did you can solve the problem?

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: query.ParamByName

Post by azyk » Thu 19 Feb 2015 09:47

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.

Post Reply