Description:
You can call MySqlHelper.ExecuteReader() either with a MySqlConnection parameter or with string parameter containing the connection-string.
In the latter case ExecuteReader should create an connection itself.
Since 6.3.5 this does not work anymore, reverting to 6.3.4 solves the problem.
How to repeat:
Execute the following code. As you can see it calls two MySqlDataReader (myReaderA and myReaderB) both with the same SQL-command, both with MySqlHelper.ExecuteReader. The first uses the manually initiated connection (myConnection) and the second one just passes the connectionString to the function. The code fails at myReaderB.Read() with the error message 'Invalid attempt to Read when reader is closed."
using MySql.Data.MySqlClient;
private void test()
{
MySqlConnection myConn;
MySqlConnectionStringBuilder myCsb;
MySqlDataReader myReaderA;
MySqlDataReader myReaderB;
myCsb = new MySqlConnectionStringBuilder();
myCsb.UserID = "root"; myCsb.Password = ""; myCsb.Server = "127.0.0.1"; myCsb.Database = "mysql";
myConn = new MySqlConnection(myCsb.GetConnectionString(true));
myConn.Open();
myReaderA = MySqlHelper.ExecuteReader(myConn, "SELECT * FROM user");
myReaderB = MySqlHelper.ExecuteReader(myCsb.ConnectionString, "SELECT * FROM user");
myReaderA.Read(); Console.WriteLine(myReaderA.GetString(1));
myReaderB.Read(); Console.WriteLine(myReaderB.GetString(1));
myReaderA.Close(); myReaderB.Close(); myConn.Close();
}
My test environment is German Win7 x64, VS2010, MySql 5.5.6 rc x64.
I also tried to use myCsb.GetConnectionString(true) instead of myCsb.ConnectionString but no difference.