diff options
author | Umadevi S <uma@mono-cvs.ximian.com> | 2004-06-18 10:01:40 +0400 |
---|---|---|
committer | Umadevi S <uma@mono-cvs.ximian.com> | 2004-06-18 10:01:40 +0400 |
commit | aeb993c977ea52da4b1777ab8f0f2d8889d250f9 (patch) | |
tree | 60b0c86feceb8fb0e69041781c2ead04ced87c18 /mcs | |
parent | d7536995bfff98aa957b0d90697a868b6fe951b0 (diff) |
2004-06-18 Umadevi S <sumadevi@novell.com>
* SqlCommand.cs - ExecuteNonQuery returns -1 in all cases except
insert,update or delete.
svn path=/trunk/mcs/; revision=29849
Diffstat (limited to 'mcs')
-rwxr-xr-x | mcs/class/System.Data/System.Data.SqlClient/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index 4b5cec2526d..085e2289428 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,4 +1,8 @@ 2004-06-18 Umadevi S <sumadevi@novell.com> + * SqlCommand.cs - ExecuteNonQuery returns -1 in all cases except + insert,update or delete. + +2004-06-18 Umadevi S <sumadevi@novell.com> * SqlConnection.cs - handled null being passed as a connectionstring - checked for minimal set of parameters in connectionstring. - handled unrecogonized keywords similar to MS.NET diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs index cf447f58a0f..366b381b54d 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs @@ -310,7 +310,16 @@ namespace System.Data.SqlClient { try { Execute (CommandBehavior.Default, false); - result = Connection.Tds.RecordsAffected; + // .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); |