time entry in date field in ado .net, problem

  • Thread starter Thread starter ray well
  • Start date Start date
R

ray well

i have an access 2000 database, in which i log incoming calls by their date
and time, so they can be retreived according to the order they were called
in.

in the date-time field, i can store a date-time by typing "1/1/2002 1:13:00
PM" directly into the table when i open it in Access. if i then ascendingly
sort the table on this field i get the log in the order they were called in.

when i use ado .net, and set this field to 'Now' in code, and i make a
breakpoint right after the line of code that does it.

ds.Tables("tblLog").Rows(ClientRowId).Item("LogDate") = Now,

and print out the field in the command window, it shows me the date and
time. so i know my code correctly got the DATE AND TIME into the field.



however when it gets updated in the database, by

DataAdapterLog.Update(ds.Tables("tblLog"))

and i then look into the database itself in Access the time is droped out,
and only the date is updated, and it sorts only by date and not by date and
time.

why is this happening, and how do i get the DATA AND TIME to get updated?



thanks for any help,

ray

please respond to the list
 
Hi ray,

Yes, I've noticed it.
Change the parameter that holds datetime field from
System.Data.OleDb.OleDbType.DBDate

to

System.Data.OleDb.OleDbType.Date

And it should work just fine.

HTH,
 
hi miha,

thanks so much. it worked as a charm. just curious how did u find this
solution?

ray
 
Hi Ray,

From the beginning the type was suspicius to me.
I tried other possible date types - and voila.
 
Back
Top