"commands out of sync" - confused

"commands out of sync" - confused

Postby shutterstock » Fri 03 Feb 2006 18:23

Ok.. so here is my situation

1) I have multiple connections open the DB at any time.
2) each connection only uses one datareader - and that datareader is always closed when im done.
3) I use connection pooling - and allow up to 250 connections to be pooled.

whenever i need a new connection - i essentially grab it from the pool.

so this means that there will be many connections at any time - but each connection uses at most 1 reader at any time, and always closes the reader.. There may be several readers open - each on it's own connection at any time.

So - why then - do I get the "commands out of sync" exception?

aren't I following all of the rules?

when i get a connection from the pool - it should give me one that doesn't have any open datareaders on it, right? and one that i already closed as well, right?

am i missing something?
shutterstock
 
Posts: 27
Joined: Sat 28 May 2005 20:37

Postby Serious » Mon 06 Feb 2006 08:26

Do you use Unicode in your application? What kind of queries do you use (stored procedures call, select from table)?
Serious
 

Postby shutterstock » Tue 07 Feb 2006 16:56

Serious wrote:Do you use Unicode in your application? What kind of queries do you use (stored procedures call, select from table)?


No unicode at all.

And no stored procedures - only selects from table.

Jon
shutterstock
 
Posts: 27
Joined: Sat 28 May 2005 20:37

Postby Serious » Wed 08 Feb 2006 07:50

If you use prepared commands make sure you call MySqlCommand.Dispose() before connection closing.
Serious
 


Return to dotConnect for MySQL