By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,032 Members | 1,205 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,032 IT Pros & Developers. It's quick & easy.

Assign a DBNull to Optional parameter

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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 ;-)
"Ed Chiu" <Ed****@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com...
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

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.