DateTime in Access via ADO.NET doesn't keep the time (only keeps the date)?

  • Thread starter Thread starter John
  • Start date Start date
J

John

I must be doing something stupid, but I can't figure it out.

I have a DateTime column in my Access database (mdb). I'm using
ADO.NET to fill a dataset and update changes to Access. I have a
datagrid to via the dataset.

When I add new items I see the date and time, but when I recall those
items from the database (after they were saved) the time is reset to
12:00 AM.

Any ideas what I could be missing?

Thanks,
John
 
If you are using parameters with your Insert Command in the Data Adapter,
which is how the wizard generates them, make sure the OleDbType is set
to DBTimeStamp. I have a number of time and date related columns in an
Access DB, and I had to adjust the OleDbType to get them to work. For a
time only type values I use DBTimeStamp.
 
Thank you for your reply. I'll try that.

I do need a date and time. I'll experiment with the OleDbType's. I
guess I shouldn't have assumed that the auto-generated code was
golden.

Thanks!
John
 
Try DBDate.
Thank you for your reply. I'll try that.

I do need a date and time. I'll experiment with the OleDbType's. I
guess I shouldn't have assumed that the auto-generated code was
golden.

Thanks!
John
 
Back
Top