DateTime in Access via ADO.NET doesn't keep the time (only keeps the 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
 
S

Stephen B. Hahn

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.
 
J

John

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
 
S

Stephen B. Hahn

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top