Creating an Optional Date Parameter

  • Thread starter Thread starter Learning SQL Server
  • Start date Start date
L

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)
 
Use DateTime.MinValue, and then check to make sure the passed value is
greater than that inside the function body.
 
Back
Top