Wrong value returned for RecordsAffected
From: Paul Ballarin (anonymous_at_discussions.microsoft.com)
Date: 02/23/04
- Next message: Reinhard: "Re: runtime error -2147024769 (8007007f)"
- Previous message: JLatA1st: "Relationships within a DataSet for updates"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 22 Feb 2004 20:36:05 -0800
Has anyone run into this before
When you execute an insert via ADO the RecordsAffected value comes back as 0 even when
the insert was successful. This was apparently caused by an insert trigger on the table which
contained a delete statement that effected 0 rows.
if I remove the delete statement or turn NOCOUNT on and off around it the RecordsAffected value is correct.
This is very easy to reproduce as the trigger does not need to actually do anything ie.
create trigger Test_1 on <some_table> for insert
if @@ROWCOUNT = 1
BEGIN
delete <some_table> where 1=2
END
I was able to cause this problem with an update trigger as well
This does not occur in ODBC.
- Next message: Reinhard: "Re: runtime error -2147024769 (8007007f)"
- Previous message: JLatA1st: "Relationships within a DataSet for updates"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|