Zajmuję się tworzeniem aplikacji WinForm z edycją Visual Studio 2012 Ultimate ze wszystkimi dodatkami Service Pack, C# i .NET Framework 4.5.Wewnętrzny błąd dostawcy danych .Net Framework 1
otrzymuję ten wyjątek:
Internal .Net Framework Data Provider error 1
Z tego stosu:
en System.Data.ProviderBase.DbConnectionInternal.PrePush(Object expectedOwner)
en System.Data.ProviderBase.DbConnectionPool.PutObject(DbConnectionInternal obj, Object owningObject)
en System.Data.ProviderBase.DbConnectionInternal.CloseConnection(DbConnection owningObject, DbConnectionFactory connectionFactory)
en System.Data.SqlClient.SqlConnection.CloseInnerConnection()
en System.Data.SqlClient.SqlConnection.Close()
en AdoData.TRZIC.DisposeCurrentConnection()
en AdoData.TRZIC.Finalize()
W destructor:
~TRZIC()
{
DisposeCurrentConnection();
if (this.getCodeCmd != null)
this.getCodeCmd.Dispose();
}
private void DisposeCurrentConnection()
{
if (this.conn != null)
{
if (this.conn.State == ConnectionState.Open)
this.conn.Close();
this.conn.Dispose();
this.conn = null;
}
}
otrzymuję wyjątek w linii this.conn.Close();
.
I conn
jest private SqlConnection conn = null;
Czy wiesz dlaczego?
Istnieją pewne błędy, nie ma potrzeby 'this.conn = null; 'po wyrzuceniu go, a także proponuję zrzucić twoje polecenie przed wywołaniem' DisposeCurrentConnection() ' – RezaRahmati