364,111 Members | 2134 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Creating an Optional Date Parameter

Learning SQL Server
P: n/a
Learning SQL Server

What should the default value for an optional Date parameter be in a
function if I want it to default to Nothing?

Setting the optional value to "" fails, so does setting it to Nothing.

Function blah(byval User as string, Optional byval UserDate as Date = ?????)

Thanks (again)



Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


Russell Jones
P: n/a
Russell Jones
Use DateTime.MinValue, and then check to make sure the passed value is
greater than that inside the function body.

"Learning SQL Server" <no.mail.com> wrote in message
news:Ol7tI%23DbDHA.2368@TK2MSFTNGP09.phx.gbl...[color=blue]
>
> What should the default value for an optional Date parameter be in a
> function if I want it to default to Nothing?
>
> Setting the optional value to "" fails, so does setting it to Nothing.
>
> Function blah(byval User as string, Optional byval UserDate as Date =[/color]
?????)[color=blue]
>
> Thanks (again)
>
>
>[/color]


Nov 19 '05 #2

Post your reply

Help answer this question



Didn't find the answer to your Visual Basic .NET question?

You can also browse similar questions: Visual Basic .NET optional date