0

C# でアクセス データベースを使用しています。

MdbLibrary というヘルパー クラスがあります。

私のアプリケーションでは、マルチスレッド呼び出しで open と close を呼び出します。

そして、以下のエラーが発生します。

An attempt has been made to free an RCW that is in use.  The RCW is in use on the active thread or another thread.  Attempting to free an in-use RCW can cause corruption or data loss.

接続を閉じるときに常に発生します。

private OleDbConnection _Conn = null;

public void Open(string _strConnectionString)
{
    _Conn = new OleDbConnection(_strConnectionString);
    _Conn.Open();

    _Command = new OleDbCommand();
    _Command.Connection = _Conn;
    if (this.ConnectionTimeOut != 30)
        _Command.CommandTimeout = this.ConnectionTimeOut;
}

public void Close()
{
    _Conn.Close();  --> here i get an error.
}

この問題を解決するアイデアはありますか?

4

0 に答える 0