Nothing and SqlDateTime overflow error
When use SQL Query, set value to parameter with type Nullable<DateTime>, if set Nothing as value directly it works,
varDateTime = Nothing -- works well
but if set Nothing as value with conditional operator, will get error:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
varDateTime = if (condition, convertToDateTime(object), Nothing) -- get above error
Can confirm that error is caused NOT by convertToDateTime(object), but by Nothing in the if statement.
This problem can be solved by using control flow and set another parameter to the value of varDateTime , but just curious:
What's the difference between those two Nothing?
Any idea will be appreciated.
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
0 kommentarer