Pass, Damien. That has me beat. I hope someone else will be able to help.
Peter -----Original Message----- From: Damien Churchill [mailto:[EMAIL PROTECTED] Sent: 20 October 2006 11:54 To: Bradley, Peter; [email protected] Subject: RE: [Mono-list] FW: MySql Connector >From the mysql site: public DataSet SelectRows(DataSet dataset,string connection,string query) { MySqlConnection conn = new MySqlConnection(connection); MySqlDataAdapter adapter = new MySqlDataAdapter(); adapter.SelectCommand = new MySqlCommand(query, conn); adapter.Fill(dataset); return dataset; } I've just modified my console program to resemble that. Receive the same error. It works fine if it's just a 'SELECT * FROM table;' but when I call that procedure it falls over. This is what's puzzling me. -----Original Message----- From: Bradley, Peter [mailto:[EMAIL PROTECTED] Sent: 20 October 2006 11:48 To: Damien Churchill; [email protected] Subject: RE: [Mono-list] FW: MySql Connector If I remember correctly, if you use a DataAdapter you don't have to worry about opening or closing the connection. The adapter does that for you: but if you do open() the connection, you absolutely must close() it. With a DataReader, you must both open and close the connection. HTH Peter -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Damien Churchill Sent: 20 October 2006 11:41 To: [email protected] Subject: [Mono-list] FW: MySql Connector 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 MySqlConnection(connectionString); dbConn.Open(); MySqlDataAdapter da = new MySqlDataAdapter(); MySqlCommand dbcmd = dbConn.CreateCommand(); dbcmd.CommandText = "CALL spUserPrivileges(1);"; DataSet ds = new DataSet(); da.SelectCommand = dbcmd; da.Fill(ds); dbcmd = null; da = null; Console.WriteLine(ds.Tables[0].Rows.Count); Console.Read(); } } } That's all it does. It works fine with other selects, and other stored procedures, just not that one. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Jordan Sent: 20 October 2006 11:28 To: [email protected] 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 be > closed first. > at MySql.Data.MySqlClient.MySqlCommand.CheckState () [0x00000] > at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (CommandBehavior > 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. Robert _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
