Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MySQL data Access Class
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01135585
Message ID:
01137437
Vues:
22
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform