Bug #18307 union doesn't work
Submitted: 17 Mar 2006 13:37 Modified: 20 Mar 2006 17:50
Reporter: Thierry Schembri Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.7.0 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[17 Mar 2006 13:37] Thierry Schembri
Description:
"Union" in Select cause a "There is already an open DataReader associated with this Connection which must be closed first." error.

How to repeat:
String cnx = "Server=xxx;Database=base;Uid=user;Pwd=pwd;";
MySqlConnection connexion  = new MySqlConnection(cnx);
connexion.Open();

String sql = "select c1 from T1 union select c1 from T2";
MySqlCommand cmd;
cmd = connexion.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = sql;

MySqlDataReader reader = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(reader);

I get the error when the DataTable is loaded (I get the same error with Binding other control).
[17 Mar 2006 14:24] Thierry Schembri
Forget my report, the problem doesn't come from the union but comes from the select clause.
In my example, c1 was " name + ' (info) ' as name ".
I've replaced it by concat(name,' (info) ') as name and it works.