Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Execute non query getting -1

Author  Topic 

aoriju
Posting Yak Master

156 Posts

Posted - 2012-04-30 : 02:37:27
Hi All,

I am getting execute non query as -1..what is it ?...It means any error in my sql

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-04-30 : 06:50:20
Depends on what the SQL code was doing. See here: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery.aspx

"For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1."
Go to Top of Page
   

- Advertisement -