Internal .Net Framework Data Provider error 1

风流意气都作罢 提交于 2019-12-01 15:15:29
VansFannel

I have found the solution here.

Basically it boils down to this:

Caution

Do not call Close or Dispose on a Connection, a DataReader, or any other managed object in the Finalize method of your class. In a finalizer, you should only release unmanaged resources that your class owns directly. If your class does not own any unmanaged resources, do not include a Finalize method in your class definition. For more information, see Garbage Collection.

Reza

This is not answer but I strongly suggest you to dispose connections using using. Then you don't need to concern about disposing objects.

using (SqlConnection connection = new SqlConnection(connectionString)) 
{    
    try    
    {
        connection.Open();
        SqlCommand command = new SqlCommand("......", connection);
        command.ExecuteNonQuery();    
    } 
    catch (Exception) 
    { 
        /*Handle error*/ 
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!