Page 1 of 1

"commands out of sync" - confused

Posted: Fri 03 Feb 2006 18:23
by shutterstock
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?

Posted: Mon 06 Feb 2006 08:26
by Serious
Do you use Unicode in your application? What kind of queries do you use (stored procedures call, select from table)?

Posted: Tue 07 Feb 2006 16:56
by shutterstock
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

Posted: Wed 08 Feb 2006 07:50
by Serious
If you use prepared commands make sure you call MySqlCommand.Dispose() before connection closing.