SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Execute non query getting -1
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

aoriju
Posting Yak Master

India
151 Posts

Posted - 04/30/2012 :  02:37:27  Show Profile  Reply with Quote
Hi All,

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

sunitabeck
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 04/30/2012 :  06:50:20  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000