D
darrel
A common problem I encounter is having to enter either a date OR a null
value into a date field in a DB.
The problem I hace is that DBNull.value isn't a proper value for a date
variable, so I can't explicitely declare the variable:
Dim myDateVariable
If Trim(tbx_postDate.Text.ToString) <> "" Then
myDateVariable= CType(tbx_postDate.Text.ToString, Date)
Else
myDateVariable= DBNull.Value
End If
Is that OK to not specifically declare the datatype for myDateVariable? Is
there a more elegant way to handle this?
-Darrel
value into a date field in a DB.
The problem I hace is that DBNull.value isn't a proper value for a date
variable, so I can't explicitely declare the variable:
Dim myDateVariable
If Trim(tbx_postDate.Text.ToString) <> "" Then
myDateVariable= CType(tbx_postDate.Text.ToString, Date)
Else
myDateVariable= DBNull.Value
End If
Is that OK to not specifically declare the datatype for myDateVariable? Is
there a more elegant way to handle this?
-Darrel