diff options
Diffstat (limited to 'mcs/class/System.Data/System.Data.SqlClient')
4 files changed, 29 insertions, 10 deletions
diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index 14efc7d3b1e..8b39fed6e74 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,3 +1,15 @@ +2004-09-24 Umadevi S <sumadevi@novell.com> + * SqlTransaction.cs - Dispose will not call rollback incase the transaction is not open. + + +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 + 2004-06-22 Atsushi Enomoto <atsushi@ximian.com> * SqlCommandBuilder.cs : Avoid cast exception caused by DbNull. 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); diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs index 52b6a0a589a..abe23c3aebf 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs @@ -131,6 +131,9 @@ namespace System.Data.SqlClient { public void Close () { + // skip to end & read output parameters + while (NextResult ()) + ; isClosed = true; command.Connection.DataReader = null; command.CloseDataReader (moreResults); diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs index f6c1ad13f5c..aa145d2c426 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs @@ -94,7 +94,8 @@ namespace System.Data.SqlClient { { if (!disposed) { if (disposing) { - Rollback (); + if (isOpen) + Rollback (); } disposed = true; } |