diff options
Diffstat (limited to 'mcs')
-rwxr-xr-x | mcs/class/System.Data/System.Data.Common/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs | 27 |
2 files changed, 26 insertions, 7 deletions
diff --git a/mcs/class/System.Data/System.Data.Common/ChangeLog b/mcs/class/System.Data/System.Data.Common/ChangeLog index 7d19f7aa1ae..4fea0c28881 100755 --- a/mcs/class/System.Data/System.Data.Common/ChangeLog +++ b/mcs/class/System.Data/System.Data.Common/ChangeLog @@ -1,3 +1,9 @@ +2003-11-23 Pedro Martínez Juliá <yoros@wanadoo.es> + + * DbDataAdapter.cs: Call command dispose in self dispose method. We + need to dispose the connections and other stuff stored in the + commands. + 2003-11-10 Pedro Martínez Juliá <yoros@wanadoo.es> * DataColumnMappingCollection.cs: Fix a missing exception when the diff --git a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs index 1b5de338d06..6b199cdbe1e 100644 --- a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs +++ b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs @@ -77,17 +77,30 @@ namespace System.Data.Common { protected override void Dispose (bool disposing) { if (disposing) { - ((IDbDataAdapter) this).SelectCommand = null; - ((IDbDataAdapter) this).InsertCommand = null; - ((IDbDataAdapter) this).UpdateCommand = null; - ((IDbDataAdapter) this).DeleteCommand = null; + IDbDataAdapter da = (IDbDataAdapter) this; + if (da.SelectCommand != null) { + da.SelectCommand.Dispose(); + da.SelectCommand = null; + } + if (da.InsertCommand != null) { + da.InsertCommand.Dispose(); + da.InsertCommand = null; + } + if (da.UpdateCommand != null) { + da.UpdateCommand.Dispose(); + da.UpdateCommand = null; + } + if (da.DeleteCommand != null) { + da.DeleteCommand.Dispose(); + da.DeleteCommand = null; + } } } - public override int Fill (DataSet dataSet) - { + public override int Fill (DataSet dataSet) + { return Fill (dataSet, 0, 0, DefaultSourceTableName, SelectCommand, CommandBehavior.Default); - } + } public int Fill (DataTable dataTable) { |