Assign a DBNull to Optional parameter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Is there a way to assign a DBNull value to an optional parameter of a
function?

I tried:
Public Function AddUpdateCases( _
ByVal CrisCaseID As Integer, _
Optional ByVal APN As DateTime = System.DBNull.value)

Doe not work for me.

Thanks in Advance
 
DateTime is a Value type so I don't think that's going to work. You can
check the .MinValue and if it is the MinValue (which it will be if its not
assigned) then set the dbcommand parameter value to dbnull. I'd also
recommend using an overload instead but that recommendation will probably
start a flame war ;-)
 
Back
Top