InvalidComObjectException, threaded db access

From: 2G (2G_at_pandora.be)
Date: 05/24/04


Date: Mon, 24 May 2004 06:13:17 +0200

Hi

>From the moment I have threaded a function that loads data from the db , I
get the following error:

An unhandled exception of type
'System.Runtime.InteropServices.InvalidComObjectException' occurred in
system.data.dll
Additional information: COM object that has been separated from its
underlying RCW can not be used.

I searched a bit on this error and saw that it could have something to do
with Marshal.ReleaseComObject but I'm not using this.

If I wait until the thread has done running and restart the thread again,
all works fine, but this thread has to be restart the moment I click a
button.
Currently I 'm stopping the running thread with .Abort() and catching the
threadabortexception , I think this has something to do with the error I'm
getting as I suspect .Abort() is not the good way to go.

Does anyone know how I could solve this?

Thanks.


Quantcast