All,

Using C# with ADO.NET I am trying to save a date time to an Access database.
After the saving occurs I open Access database and only see the date not the
time.
I know the time was part of the DateTime object prior to saving it. Also
while in Access I tried changing the format of the date time field to see the
time, which showed it as 12:00 AM and is incorrect.
See code snippet below:
DataRow newRow = dataSet12.Table1.NewRow();
newRow["Index"] = 5;
newRow["Column1"] = "Added";
newRow["MyDateTime"] = DateTime.Now; // <== Time is in object
dataSet12.Table1.Rows.Add(newRow);
Does anyone know who to have the time saved ad well?

Thanks in advance for any help.
Scott

Re: Time is Stripped off When Saving DateTime to MS Access by Chad

Chad
Tue Jun 28 05:15:34 CDT 2005

"=?Utf-8?B?U2NvdHQ=?=" <Scott@discussions.microsoft.com> wrote in
news:B955442E-F71D-4A5D-9051-B6574DBEFD9C@microsoft.com:
> Using C# with ADO.NET I am trying to save a date time to an Access
> database. After the saving occurs I open Access database and only see
> the date not the time.

What is the exact field type as declared in Access?


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu

Re: Time is Stripped off When Saving DateTime to MS Access by Scott

Scott
Tue Jun 28 06:50:01 CDT 2005

The field type in Access is defined as Date/Time.

"Chad Z. Hower aka Kudzu" wrote:

> "=?Utf-8?B?U2NvdHQ=?=" <Scott@discussions.microsoft.com> wrote in
> news:B955442E-F71D-4A5D-9051-B6574DBEFD9C@microsoft.com:
> > Using C# with ADO.NET I am trying to save a date time to an Access
> > database. After the saving occurs I open Access database and only see
> > the date not the time.
>
> What is the exact field type as declared in Access?
>
>
> --
> Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
> "Programming is an art form that fights back"
>
> Blog: http://blogs.atozed.com/kudzu
>

Re: Time is Stripped off When Saving DateTime to MS Access by Scott

Scott
Wed Jun 29 12:16:06 CDT 2005

Note to everyone: The solution to resolve this was to set the DateTime type
in the command objects (I.E. oleDbInsertCommand2) from OleDbType.DBDate to
OleDbType.DBTimeStamp.
Doing this now generates both a date and time in an Access database.

"Scott" wrote:

> The field type in Access is defined as Date/Time.
>
> "Chad Z. Hower aka Kudzu" wrote:
>
> > "=?Utf-8?B?U2NvdHQ=?=" <Scott@discussions.microsoft.com> wrote in
> > news:B955442E-F71D-4A5D-9051-B6574DBEFD9C@microsoft.com:
> > > Using C# with ADO.NET I am trying to save a date time to an Access
> > > database. After the saving occurs I open Access database and only see
> > > the date not the time.
> >
> > What is the exact field type as declared in Access?
> >
> >
> > --
> > Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
> > "Programming is an art form that fights back"
> >
> > Blog: http://blogs.atozed.com/kudzu
> >