I want to be able to do a conditional with both null and int.
I have many overloads for SetParameter. One has the last parameter as integer and on that has it as DBNull.
Both work fine individually but if I use a conditional, I can't because the types are different and there is no implicit conversion.
One result was to cast one of the sides to (object). But then it would pick the right overload. Is there a way to do this?
Thanks,
Tom
Code:
database.SetParameter("@UserID", SqlDbType.Int, companyID == null? DBNull.Value : companyID),
I have many overloads for SetParameter. One has the last parameter as integer and on that has it as DBNull.
Both work fine individually but if I use a conditional, I can't because the types are different and there is no implicit conversion.
One result was to cast one of the sides to (object). But then it would pick the right overload. Is there a way to do this?
Thanks,
Tom