Bug #13649 Cannot execute more than one query with a single connection
Submitted: 30 Sep 2005 11:50 Modified: 3 Oct 2005 15:04
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.5 OS:Microsoft Windows (Windows 2003 Server)
Assigned to: Reggie Burnett CPU Architecture:Any

[30 Sep 2005 11:50] [ name withheld ]
Description:
When I try to execute 2 ExecuteDataReader I get the following message:
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly.  Make sure "MySql.Data.MySqlClient.MySqlClient.Strings.resources" was correctly embedded or linked into assembly "MySql.Data".
baseName: MySql.Data.MySqlClient.MySqlClient.Strings  locationInfo: <null>  resource file name: MySql.Data.MySqlClient.MySqlClient.Strings.resources  assembly: MySql.Data, Version=1.0.5.13785, Culture=neutral, PublicKeyToken=c5687fc88969c44d

How to repeat:
MySqlConnection oConn = new MySqlConnection();
oConn.ConnectionString = "Database=db;Data Source=localhost;User Id=root;Password=";
oConn.Open();
MySqlCommand oCmd;
oCmd = new MySqlCommand("SELECT * FROM tableName");
MySqlDataReader oRs = oCmd.ExecuteReader();
oRs = oCmd.ExecuteReader(); // This raise the exception

Suggested fix:
A dirty way to solve this problem is to close and open the connection before executing the query:

oConn.Close();
oConn.Open();
MySqlDataReader oRs = oCmd.ExecuteReader();
[2 Oct 2005 11:09] Vasily Kishkin
Thanks for the bug report. I was able to reproduce the bug. Test case is attached.
[2 Oct 2005 11:10] Vasily Kishkin
Test case

Attachment: 13649.zip (application/x-zip-compressed, text), 5.55 KiB.

[3 Oct 2005 3:48] Robert McKee
That's normal.  Works the same on SQL Server.  You can not open two datareaders on the same connection.  I believe you CAN open a second one, but only after you have read through all the records from your first datareader, but I haven't tried it.
[3 Oct 2005 15:04] 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:

Webmaster

You are seeing two issues.  The missing manifest resource exception has been fixed in 1.0.6.  The other issue is executing two readers off the same connection.  You cannot execute any query on a connection while a data reader is currently open on that connection.  This is the same across all ADO.Net providers.  To execute a new query, you must first close any existing data reader on that connection.

Reggie