We help IT Professionals succeed at work.
Get Started

Time data type not saving from data grid to access

Sivasan asked
Last Modified: 2012-05-09
Hi there,
I have made an vb.net 2003 application and display data from back end ms access database table to data grid in the vb.net.
I have a time field in my access table Time data type date/time.

When I want to put a time in my data grid and save it doesn't save to the Time field, every other field would save.
The only way I can make the time field save into the access time field is only when I change my Time field from Time data type to String data type in the Data set  by going int view schema and also by manually changing

Me.OleDbUpdateCommand4.Parameters.Add(New System.Data.OleDb.OleDbParameter("Time", System.Data.OleDb.OleDbType.DBDate, 0, "Time"))

Bt changing this AS A VARCHAR

Me.OleDbInsertCommand4.Parameters.Add(New System.Data.OleDb.OleDbParameter("Time", System.Data.OleDb.OleDbType.VarWChar, 50, "Time"))
It works when I do this, the only problem I have is the Time appear with the data like
12/30/1899 7:00:00 AM so looks ugly and I will have to make the row size bigger for the time to be visable.
Why does this happen, how can I keep it as Time data time and still be able to save in access
Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE