Petite question sur le format datetime = nothing
Bonjour
J'aurais d'un peu de vos lumières car je n'ai pas trouvé de réponse sur internet à ceci :
Dans le cas #1 :
myDateStart = Nothing
alors que dans le cas #2 :
myDateStart = 01/01/0001 00:00:00
Je comprends pas pourquoi cette différence, selon moi il n'y a pas de différence d’algorithmie, juste une différence de syntaxe
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
Public myDateStart As DateTime? = Nothing
Public Sub maFct()
'-> DT.Rows(0)("maCol") = NULL
' // #1 ////
If (Not IsNothing(DT.Rows(0)("maCol")) And (IsDate(DT.Rows(0)("maCol")))) Then
myDateStart = CDate(DT.Rows(0)("maCol"))
Else
myDateStart = Nothing
End If
' // #2 ////
myDateStart = If((Not IsNothing(DT.Rows(0)("maCol")) And (IsDate(DT.Rows(0)("maCol")))), CDate(DT.Rows(0)("maCol")), Nothing)
End Sub |
Merci de votre aide