모든 서비스 팩, C# 및 .NET Framework 4.5가 포함 된 Visual Studio 2012 Ultimate 에디션으로 WinForm 응용 프로그램을 개발하고 있습니다. 이 스택으로내부 .NET Framework 데이터 공급자 오류 1
Internal .Net Framework Data Provider error 1
:
나는이 예외가
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()
소멸자에서 :
~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;
}
}
I 라인 this.conn.Close();
에서 예외를 얻을.
그리고 conn
는
private SqlConnection conn = null;
당신은 이유를 알고 있습니까입니까?
몇 가지 실수가 있습니다, 당신은 this.conn'에 필요하지 않습니다 = null;'을 삭제 한 후'DisposeCurrentConnection()'을 호출하기 전에 명령을 폐기하는 것이 좋습니다. – RezaRahmati