I've got a GUI where various areas of the data proven is removed from the database. To ensure that the GUI to not freeze up I have attempted putting the database queries in BackgroundWorkers. Since these access the database asynchronously I recieve the best saying the database connection has already been open and utilized by another.
Can you really produce a queue for database access?
I have investigated Task and ContinueWith, consider i code against .Internet framework 3.5 this isn't a choice.
What's the DB engine you are using? Most contemporary databases are enhanced for concurrent procedures, so you shouldn't have to queue anything.
The one thing you are appaently doing wrong is re-using exactly the same
IDbConnection instance across different threads. Thats a no-no: each thread needs to have its very own instance.
I believe your condition is in the manner you receive a link with the database. If you wish to fire separate queries you could utilize separate connections for separate demands. Should you enable connection pooling this doesn't add lots of overhead.
Use the pool objects. Plus according to your description your attempting to open an association with an unclosed connection object.