DateTime Frustration...

R

Roy Eyman

I am developing a .NET application in C# that uses an
Access database via oledb. I have created the Access
database in Access design view, created a DataTime column
with no formatting or input mask.

In my C# application I am setting this field to the
current datetime using DateTime.Now. No errors are
reported, but when I go back and open the database and
look at the datetime field, all that is there is the date,
the time is not included. I've tried all the formatting
methods in C#, such as DateTime.Now.ToLongDateString(),
etc., but nothing makes any difference; I always get the
date, but not the time.

What am I doing wrong?

Thanks,
Roy.
 
R

Roy

I found it, I built the C# dataAdapter object with the
Visual Studio designer and it defaults DateTime fields
from Access tables to type "DBDate" in it's autogenerated
code. Once I found this I simply changed the datatype in
the autogenerated code to DBTimeStamp and everything works
fine now.

Thanks,
Roy
 

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