Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing Command.CommandType To Overloaded Method
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01389389
Message ID:
01389399
Views:
28
Just pass CommandType.Text by default instead of null. You would not have to check anything.

>I want to set up the following:
>
>
>public DataSet ExecuteQuery(string sCommand, string sTableName, SqlParameter[] aParams)
>{
>    return ExecuteQuery(sCommand, sTableName, aParams, null);
>}
>public DataSet ExecuteQuery(string sCommand, string sTableName, SqlParameter[] aParams, CommandType Type)
>{
>.
>.
>.
>    if (Type == null)
>    {
>        Type = CommandType.Text;
>    }
>    oCommand.CommandType = Type;
>
>}
>
>
>This doesn't compile because I can't pass null to the last param, and I can't check in the IF to see if the param is null. What's the right way to do this?
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform