Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DbParameter vs SqlParameter Problem
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
DbParameter vs SqlParameter Problem
Divers
Thread ID:
01447664
Message ID:
01447664
Vues:
551
I have a data access class with an ExecuteQuery method. It takes the following parameters:
public DataSet ExecuteQuery(string Command, List<DbParameter> Parameters, CommandType Type)
{
.
.
.
}
I'm trying to use it like this:
public static bool DeleteCategory(int CategoryKey)
{
    SqlParameter pRecordKey = new SqlParameter("@CategoryKey", CategoryKey);

    List<SqlParameter> colParams = new List<SqlParameter>();
    colParams.Add(pRecordKey);

    try
    {
        DataSet ds = DataProcs.ExecuteQuery("as_RemoveCategory", colParams, CommandType.StoredProcedure);
    }
    catch (Exception e)
    {
        throw;
    }
}
It won't compile. Getting:
The best overloaded method match for 'Marois.Common.DataAccess.DataAccess.ExecuteQuery(string, string,
System.Collections.Generic.List<System.Data.Common.DbParameter>)' has some invalid arguments
I thought that since the class is using DbParameters that I could pass SqlParamaters since SqlParameter inherits from System.Data.Common.DbParameter.

Anyone know what't wrong?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform