A
Abhishek Srivastava
Hello All,
I wrote a program in which I have a OleDbConnection which I open in the
contructor and close in the Destructor. When I run the program I get the
following error
Unhandled Exception: System.InvalidOperationException: Handle is not
initialized
..
at System.WeakReference.get_Target()
at System.Data.Common.WeakReferenceCollection.Close(Boolean flag)
at System.Data.OleDb.OleDbConnection.CloseReferences(Boolean canceling)
at System.Data.OleDb.OleDbConnection.DisposeManaged()
at System.Data.OleDb.OleDbConnection.Close()
at LoadCkpt.Finalize()
If I remove the contructor and destructor and open and close the
connection in my method only, then the program runs successfully.
I don't understnad why is this error coming? Why is it that I can't
open/close my connection in my contructor descructor?
Has anyone else seen this kind of error?
I will be very gratefull for your response.
regards,
Abhishek.
I wrote a program in which I have a OleDbConnection which I open in the
contructor and close in the Destructor. When I run the program I get the
following error
Unhandled Exception: System.InvalidOperationException: Handle is not
initialized
..
at System.WeakReference.get_Target()
at System.Data.Common.WeakReferenceCollection.Close(Boolean flag)
at System.Data.OleDb.OleDbConnection.CloseReferences(Boolean canceling)
at System.Data.OleDb.OleDbConnection.DisposeManaged()
at System.Data.OleDb.OleDbConnection.Close()
at LoadCkpt.Finalize()
If I remove the contructor and destructor and open and close the
connection in my method only, then the program runs successfully.
I don't understnad why is this error coming? Why is it that I can't
open/close my connection in my contructor descructor?
Has anyone else seen this kind of error?
I will be very gratefull for your response.
regards,
Abhishek.