diff options
author | Umadevi S <uma@mono-cvs.ximian.com> | 2004-09-02 12:44:02 +0400 |
---|---|---|
committer | Umadevi S <uma@mono-cvs.ximian.com> | 2004-09-02 12:44:02 +0400 |
commit | a99c7b6d01fd074b99969c5e89e0eea81dfde986 (patch) | |
tree | 8a7d650c522f4fcd3d44bcf1a100f9bbf96b5705 | |
parent | 450b34a6867f66df3872b52a9c20e2ef8e89dc70 (diff) |
2004-09-02 Umadevi S <sumadevi@novell.com>
* SqlCommand.cs - ExecuteNonQuery to return -1 incase of executing a storedprocedure
svn path=/branches/mono-1-0/mcs/; revision=33199
-rwxr-xr-x | mcs/class/System.Data/System.Data.SqlClient/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs | 21 |
2 files changed, 16 insertions, 9 deletions
diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index 55a0ce00782..8cbc2916c38 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,3 +1,7 @@ +2004-09-02 Umadevi S <sumadevi@novell.com> + * SqlCommand.cs - ExecuteNonQuery to return -1 incase of executing a storedprocedure + + 2004-08-12 Sureshkumar T <tsureshkumar@novell.com> * SqlDataReader.cs - In Close method, the remaining resultsets are drained out, to read output parameters & to avoid stream overlap diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs index 366b381b54d..a5ada9fd053 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs @@ -310,16 +310,19 @@ namespace System.Data.SqlClient { try { Execute (CommandBehavior.Default, false); - // .NET documentation says that except for INSERT, UPDATE and - // DELETE where the return value is the number of rows affected - // for the rest of the commands the return value is -1. - if ((CommandText.ToUpper().IndexOf("UPDATE")!=-1) || - (CommandText.ToUpper().IndexOf("INSERT")!=-1) || - (CommandText.ToUpper().IndexOf("DELETE")!=-1)) - result = Connection.Tds.RecordsAffected; - else + if (commandType == CommandType.StoredProcedure) result = -1; - + else { + // .NET documentation says that except for INSERT, UPDATE and + // DELETE where the return value is the number of rows affected + // for the rest of the commands the return value is -1. + if ((CommandText.ToUpper().IndexOf("UPDATE")!=-1) || + (CommandText.ToUpper().IndexOf("INSERT")!=-1) || + (CommandText.ToUpper().IndexOf("DELETE")!=-1)) + result = Connection.Tds.RecordsAffected; + else + result = -1; + } } catch (TdsTimeoutException e) { throw SqlException.FromTdsInternalException ((TdsInternalException) e); |