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:
01136485
Vues:
10
Stuart,

The good news is, you're not doing anything wrong <s>.

>Error 1 Cannot convert type 'System.Data.Common.DbCommandBuilder'

The bad news is I did a little research and found that MySqlCommandBuilder is not derived from DbCommandBuilder (a BIG mistake on their part). They have had a number of requests to fix this problem. For now, it's not a perfect solution, but you can get around this problem for now by changing the CommandBuilder property to the following (don't call CreateCommandBuilder from the get...instaniate it directly):
protected virtual MySqlCommandBuilder CommandBuilder
{
    get
    {
        // If a Command Builder doesn't exist, create one
        if (this._commandBuilder == null)
        {
            this._commandBuilder = new MySqlCommandBuilder(this.DataAdapter);
        }
        return this._commandBuilder;
    }
    set { this._commandBuilder = value; }
}
Again, you're getting this error because they didn't subclass MySqlCommandBuilder from DbCommandBuilderTo get rid of this error, don't override the CreateCommandBuilder method, which is OK since you're not calling it anyway. So just remove this code from your subclass:
public override DbCommandBuilder CreateCommandBuilder(IDbDataAdapter dataAdapter)
{
     return  new MySqlCommandBuilder((MySqlDataAdapter)dataAdapter);
}
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