Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MySQL data Access Class
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01135585
Message ID:
01137437
Views:
20
>Hi Kevin
>
>Well I have made a little progress but it crashes wihen I call this.SaveRow() at this code
>
>
>    public override IDbCommand CreateInsertCommand()
>        {
>            return  this.CommandBuilder.GetInsertCommand();
>
>        }
>
>
>With the error “Connection must be valid and open”

It looks like MySql needs you to manually open the connection (SQL Server does it automatically for you). You can add a call to this.OpenSqlConnection() somewhere in the data access class. Depending on how pervasive the need is to open the connection manually, you COULD add the code to the connection object's factory method. For example:
public override IDbConnection CreateConnection()
{
	// Create a connection based on the specified Connection string
	MySqlConnection Connection = new MySqlConnection(this.ConnectionString);

	Connection.Open();

	return Connection;
}
Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform