date in datagridview - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

date in datagridview

thusharathushara Posts: 38Member
During Saving
Dim D As Date
If Not IsDBNull(DataGridView.CurrentRow.Cells(4).Value) Then
D = CDate(DataGridView.CurrentRow.Cells(4).Value)
Else
D = Now
End If
i dont want here D=now,if i comment it in the database it is saving as 01/01/1900,
i want null instead of that

Comments

  • seancampbellseancampbell Pennsylvania, USAPosts: 684Member ✭✭✭
    Database Date fields cannot store Null values. That is why it comes in with a Year 1900.

    Hope this helps,
    Sean C
Sign In or Register to comment.