time keeps converting itself to date!

U

Usarian Skiff

I am accessing an Access db. I generated the adapter and ds thru the
wizard.

I have a datetime field in the database (simply called Time) that I am
posting to from a textbox. I had to convert it to dattime format, which
seems to go fine, but when I execute the update, it strips the time portion
and just leaves the date. Here is my conversion code:

dr("Time") = DateTime.Parse("9:32 PM")
Thanks in advance!
 
G

Guest

Where do you see the time being dropped? In the access database itself? If
so, check your Time column's Format property.

Access stores all of it's Date/Time data as both date and time but then uses
the Format property of the table's column to decide how to filter the value
for display. So for example if you have a Date/Time value of '1899-12-30
09:52:00 PM' (which occurs if you only set the time value) and have the
format set to "Short Date" all you will see is "12/30/1899" displayed. If you
have the format set to "Long Time" you will see "9:52:00 PM" displayed.

Setting a Date/Time field with only a Time defaults the date portion to the
minimum value supported by Access just as setting a Date/Time field with only
a Date value default the time portion to the minimum value.

Paul
 
G

Guest

Where do you see the time being dropped? In the access database itself? If
so, check your Time column's Format property.

Access stores all of it's Date/Time data as both date and time but then uses
the Format property of the table's column to decide how to filter the value
for display. So for example if you have a Date/Time value of '1899-12-30
09:52:00 PM' (which occurs if you only set the time value) and have the
format set to "Short Date" all you will see is "12/30/1899" displayed. If you
have the format set to "Long Time" you will see "9:52:00 PM" displayed.

Setting a Date/Time field with only a Time defaults the date portion to the
minimum value supported by Access just as setting a Date/Time field with only
a Date value default the time portion to the minimum value.

Paul
 
U

Usarian Skiff

I've narrowed down the problem a bit more. I went into the field and changed
the format to Time like you suggested. It's now correct when entering data
directly into the database, but my dataset still sees everything as date
only.

I gave a shot at changing the time column's setting to 'time' in the xsd in
my ap. Didn't work.

I erased my adapter, ds, and connection and regenerated everything through
the wizrd. Didn't work.

I erased them completely and typed in all my connectivity. Wrote the select
and initiated a commandbuilder to cover the rest. STILL didn't work.



The only thing I can think of trying at this point is my son's t-ball bat,
but I'll hold that thought a few more hours to see if someone can help.



Thanks!

Usarian
 

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