ExecuteNonQuery Issue

B

Buddy

Hello,

I need to know how I can filter out the trigger rows
effected from the rows effected value.
E.g.
//my query is='UPDATE Person WHERE PersonId=3
//this query will have a UPDATE TRIGGER will will
//copy the current person record into a history table.
//If I run the above query in Query Analyser then
//1 Row effected message appears twice. (one for the
//update and the other for the trigger)
int numRowsEffected=myoleDbCommand.ExecuteNonQuery();

How do I turn off the trigger count so ExecuteNonQuery
returns 1.

Thanks
 
K

Kevin Sun [MS]

Try this in the query statement.
SET NOCOUNT OFF

You can also create a store procedure and get the number of affected rows
by using @@ROWCOUNT



Sincerely,

Kevin
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! - www.microsoft.com/security

--------------------
| Content-Class: urn:content-classes:message
| From: "Buddy" <[email protected]>
| Sender: "Buddy" <[email protected]>
| Subject: ExecuteNonQuery Issue
| Date: Wed, 2 Jul 2003 04:18:32 -0700
| Lines: 18
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcNAi6uclwJ5iSwSRlOewIF8H4RC1g==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa09.phx.gbl
| Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.framework.adonet:9693
| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Hello,
|
| I need to know how I can filter out the trigger rows
| effected from the rows effected value.
| E.g.
| //my query is='UPDATE Person WHERE PersonId=3
| //this query will have a UPDATE TRIGGER will will
| //copy the current person record into a history table.
| //If I run the above query in Query Analyser then
| //1 Row effected message appears twice. (one for the
| //update and the other for the trigger)
| int numRowsEffected=myoleDbCommand.ExecuteNonQuery();
|
| How do I turn off the trigger count so ExecuteNonQuery
| returns 1.
|
| Thanks
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top