An attempt has been made to free an RCW that is in use error occurs when using OleDbConnection in c# -
i using access database in c#.
i have helper class called mdblibrary.
in application, multi thread calls open , close.
and gives error below:
an attempt has been made free rcw in use. rcw in use on active thread or thread. attempting free in-use rcw can cause corruption or data loss.
it happen when closing connection.
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 error. }
any idea fix problem?
Comments
Post a Comment