[Mono-list] FW: MySql Connector

Damien Churchill damien.churchill at ukplc.net
Fri Oct 20 06:40:33 EDT 2006

Yeah I would have thought that as well, but that's on a single
statement. I wrote a simple console program to test it.

using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
namespace mysqltest
    class Program
        static void Main(string[] args)
            string connectionString =
                "Server=***.***.***.***;" +
                "Database=********;" +
                "User ID=********;" +
                "Password=********;" +
                "Allow Zero Datetime=true";

            MySqlConnection dbConn = new

            MySqlDataAdapter da = new MySqlDataAdapter();
            MySqlCommand dbcmd = dbConn.CreateCommand();
            dbcmd.CommandText = "CALL spUserPrivileges(1);";
            DataSet ds = new DataSet();

            da.SelectCommand = dbcmd;

            dbcmd = null;
            da = null;


That's all it does. It works fine with other selects, and other stored
procedures, just not that one.

-----Original Message-----
From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Robert Jordan
Sent: 20 October 2006 11:28
To: Mono-list at lists.ximian.com
Subject: Re: [Mono-list] MySql Connector

Damien Churchill wrote:
> I was wondering has anyone else has experienced this:
> Unhandled Exception: MySql.Data.MySqlClient.MySqlException: There is
> already an open DataReader associated with this Connection which must
> closed first.
>   at MySql.Data.MySqlClient.MySqlCommand.CheckState () [0x00000] 
>   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader
> behavior) [0x00000] 
>   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader () [0x00000] 
>   at (wrapper remoting-invoke-with-check)
> MySql.Data.MySqlClient.MySqlCommand:ExecuteReader ()
>   at MySql.Data.MySqlClient.Driver.ReportWarnings () [0x00000]
> I receive this error when trying to execute a stored procedure (other
> SQL statements work fine, even other stored procedures). It works fine
> on windows with .NET but on mono (windows or linux) I receive that
> error.

You're not closing the previous reader. It doesn't fail on MS.NET
because their garbage collector is probably disposing the reader
faster than Mono's.


Mono-list maillist  -  Mono-list at lists.ximian.com

More information about the Mono-list mailing list