"Invalid operation. The connection is closed." when setting the connectionstring property

"Invalid operation. The connection is closed." when setting the connectionstring property

Postby Desperado » Tue 17 Jun 2008 11:27

Version: VS 2005 - MyDirect.net 3.50

After upgrading a class library project from VS.NET (and MyDirect.Net for VS.NET) to VS2005 (with MyDirect.net for VS 2005) i start getting a strange error when in initialize my data Class:

private void InitializeComponent()
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataSted));
this.connMySQLdb4 = new CoreLab.MySql.MySqlConnection();
this.daStedGen = new CoreLab.MySql.MySqlDataAdapter();
this.mySqlSelectCommand1 = new CoreLab.MySql.MySqlCommand();

Then on this, the whole thing crashes:

this.connMySQLdb4.ConnectionString = "User=******;Password=******;Host=my.*****.**;Pooling=True;Connection Lifetime" +
"=60;Min Pool Size=0;Max Pool Size=100;Database=db4;";

Stack trace as such:

[InvalidOperationException: Invalid operation. The connection is closed.]
CoreLab.Common.DbConnectionClosed.ChangeDatabase(String database) +54
CoreLab.Common.DbConnectionBase.ChangeDatabase(String value) +16

For some reason it seems to try to change the database when setting the connection string - this even applies if i drop the database setting from the connection.
Posts: 8
Joined: Mon 08 Nov 2004 08:05
Location: Norway

Postby Alexey.mdr » Tue 17 Jun 2008 12:36

Could you please try MyDirect .NET v.3.55.25?
If the problem is still there please send me (alexeyman*crlab*com) a small test project to reproduce the problem.
It is desirable to use 'test' schema objects, otherwise
include the definition of your own database objects.
If it is impossible for you to create the test project, send
us a piece of your code where the error occurs or describe steps to
reproduce the problem.
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Return to dotConnect for MySQL