running multiple queries with one connection
Posted by: Chris Bassett
Date: September 18, 2014 11:01AM

I'm writing an application (Windows based using Visual C# 2012) that will be interacting with a MYSQL database.

I have implemented the Singleton pattern for the connection so that each instance of the application is only allowed one connection (At a time) to the database, to keep resource usage down.

My issue now is that when I'm trying to perform multiple "read" queries (using ExecuteQuery), I get an exception thrown saying that there is already a connection open for the command and that the connection needs to be closed first.

I've tried to "close" the Command object, and then setting it to null, then reassigning it and then performing the query, but I still get the same error.

Any ideas?

Options: ReplyQuote


Subject
Written By
Posted
running multiple queries with one connection
September 18, 2014 11:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.