Intern .Net Framework-Datenanbieter Fehler 1

Entwickle ich eine WinForm-app mit Visual Studio 2012 Ultimate edition mit allen service pack -, C# - und .NET Framework 4.5.

Bekomme ich diese exception:

Internal .Net Framework Data Provider error 1

Mit diesem stack:

   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() 

Im Destruktor:

~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;
    }
}

Bekomme ich die exception in Zeile this.conn.Close();.

Sowie conn ist private SqlConnection conn = null;

Wissen Sie, warum?

  • Es gibt einige Fehler, die Sie nicht brauchen, um this.conn=null; nach entsorgen es, und auch ich schlage vor, Sie zu entsorgen Sie Ihren Befehl vor dem Aufruf DisposeCurrentConnection()
InformationsquelleAutor VansFannel | 2014-04-09
Schreibe einen Kommentar