Rows Affected problem

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
atome
Posts: 5
Joined: Mon 02 Sep 2013 08:02

Rows Affected problem

Post by atome » Mon 23 Dec 2013 17:03

Hello,
I have a problem with Rows Affected property.
With TMSSQL component the value of RowsAffected property depends from table trigger on update and delete commands. While ApplyUpdates of TMSQuery fails on delete command.
The property DMLRefresh of TMSQuery is active and insert/update commands work.
How to use TMSSQL without modify trigger to reflect rows affected not considering trigger rows?
Why TMSQuery has a different behavior?

SDAC version: 6.7.13 in Delphi XE4.
Thanks.

Alessandro

AndreyZ

Re: Rows Affected problem

Post by AndreyZ » Wed 25 Dec 2013 07:22

Hello,

You can avoid this problem by adding the "SET NOCOUNT ON" line to the code of your triggers.

atome
Posts: 5
Joined: Mon 02 Sep 2013 08:02

Re: Rows Affected problem

Post by atome » Fri 27 Dec 2013 10:20

Hello,
I can't modify triggers because they are not under my control.
With old version of SDAC the returned number of rows affected was correct.
Can you suggest a way to modify your component code to mantain old behavior?

Thanks.

AndreyZ

Re: Rows Affected problem

Post by AndreyZ » Fri 27 Dec 2013 15:41

Please try creating a small sample that demonstrates the problem and send it to support*devart*com , including a script to create all needed server objects (tables, triggers, etc.).
Also, please specify the exact version of your SQL Server server and client. You can learn it from the Info sheet of TMSConnection Editor.

atome
Posts: 5
Joined: Mon 02 Sep 2013 08:02

Re: Rows Affected problem

Post by atome » Fri 03 Jan 2014 16:20

Hello,
I have sent to [email protected] a small example project. Please, see email.

Thank you.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Re: Rows Affected problem

Post by Dimon » Wed 08 Jan 2014 14:21

The point is that TMSQuery returns a correct result - count of updated rows, and TMSSQL returns count of rows in the resultset returned by the trigger.
This behaviour depends on the SQL Server specificity, and we can't influence it.

With old version of SDAC the returned number of rows affected was correct.
Please specify the exact SDAC version, where this behaviour was different from the current one.

Post Reply