Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DbParameter vs SqlParameter Problem
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
DbParameter vs SqlParameter Problem
Miscellaneous
Thread ID:
01447664
Message ID:
01447664
Views:
552
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
Next
Reply
Map
View

Click here to load this message in the networking platform