16,549
社区成员
发帖
与我相关
我的任务
分享
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposed Then
If disposing Then
' Insert code to free unmanaged resources.
End If
' Insert code to free shared resources.
End If
Me.disposed = True
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Protected Overrides Sub Finalize()
Dispose(False)
MyBase.Finalize()
End Sub
[/Quote]
Protected Overrides Sub Finalize()
If mOleDbConnection.State <> ConnectionState.Closed Then mOleDbConnection.Close() : MessageBox.Show("1")
MyBase.Finalize()
End Sub
也报同样的错误。在这个过程中mOleDbConnection.State是打开的,执行的关闭的时候报错,垃圾回收压根就不是通过.Finalize进行