Assign a DBNull to Optional parameter

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
 
W

W.G. Ryan eMVP

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 ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top