Bug #8819 MySqlConnection.CreateCommand bug
Submitted: 26 Feb 2005 7:30 Modified: 28 Feb 2005 0:13
Reporter: yuki endo Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.4 OS:Windows (Windows XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[26 Feb 2005 7:30] yuki endo
Description:
Two or more Command cannot be used.
Operation is different from System.Data.SqlClient.

Therefore, more connections might become necessary.

How to repeat:
string cs = "Server=localhost; Database=golf; User Id=root; Password=;";
MySqlConnection con = new MySqlConnection(cs);
con.Open();

MySqlCommand cmd1 = con.CreateCommand();
cmd1.CommandText = "SELECT * FROM customers;";
MySqlCommand cmd2 = con.CreateCommand();
cmd2.CommandText = "SELECT * FROM customers;";

MySqlDataReader dr1 = cmd1.ExecuteReader();
MySqlDataReader dr2 = cmd2.ExecuteReader();

Exception:
MySql.Data.MySqlClient.MySqlException: There is already an open DataReader associated with this Connection which must be closed first.
[28 Feb 2005 0:13] Reggie Burnett
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

You cannot do this with SqlClient either.