Dates added to times in Access database

  • Thread starter Thread starter Steve via .NET 247
  • Start date Start date
S

Steve via .NET 247

I have been trying to update dates and times in an access database using VB .NET.

I use the parse and format events of a data binding to set the required format for the field. This works fine for dates but when I store times I get the current date inserted as well.

The parse and format events both point to the same time formatting function which is:

Private Sub TextBoxTime_Format(ByVal sender As Object, ByVal e As ConvertEventArgs)

If e.Value.ToString() = "" Then
e.Value = DBNull.Value
Else
e.Value = Format(e.Value.ToString, "Short Time")
End If
End Sub

What's going wrong?

Cheers, Steve
 
Hi,

Time is always a part of DateTime.
Thus it can't be on its own.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Steve via .NET 247 said:
I have been trying to update dates and times in an access database using VB .NET.

I use the parse and format events of a data binding to set the required
format for the field. This works fine for dates but when I store times I get
the current date inserted as well.
 
Back
Top