Link to home
Start Free TrialLog in
Avatar of Ed
EdFlag for United Kingdom of Great Britain and Northern Ireland

asked on

1900-01-01 in date field problem

I have a function that deals with NULLS a datefield.

This works to a point but puts in the date 1900-01-01  when a NULL is entered from    FW_DATECOMPLIANTTextBox.TexT

        Dim dtDateCompliant As String = FW_DATECOMPLIANTTextBox.Text
            If String.IsNullOrEmpty(dtDateCompliant) Or Not IsDate(dtDateCompliant) Then
                FW_DATECOMPLIANTTextBox.Text = ""
                dtDateCompliant = System.Data.SqlTypes.SqlDateTime.Null
                cmd.Parameters.AddWithValue("@FW_DATECOMPLIANT", dtDateCompliant)
            Else
                cmd.Parameters.AddWithValue("@FW_DATECOMPLIANT", CDate(dtDateCompliant))
            End If

Open in new window


How can I solve this so it just inputs NULL?
ASKER CERTIFIED SOLUTION
Avatar of Lokesh B R
Lokesh B R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ed

ASKER

yes ... doh!