diff options
author | Pedro Martínez Juliá <pedro@mono-cvs.ximian.com> | 2003-11-23 20:28:59 +0300 |
---|---|---|
committer | Pedro Martínez Juliá <pedro@mono-cvs.ximian.com> | 2003-11-23 20:28:59 +0300 |
commit | cb09b2aa7151b0a867bf1bf3f917106e036d9a72 (patch) | |
tree | 7148c55aad07722a410014f7720024bc16b15728 /mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs | |
parent | 81ca226d7563e628b29dfad09a55afaadb7eea7a (diff) |
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.
svn path=/trunk/mcs/; revision=20355
Diffstat (limited to 'mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs')
-rw-r--r-- | mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs | 27 |
1 files changed, 20 insertions, 7 deletions
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) { |