Re: Typed dataset: Time only data in SQL dateTime Field
- From: JeffDotNet <JeffDotNet@xxxxxxxxxxxxxxxxx>
- Date: Fri, 19 Jan 2007 12:25:06 -0800
Stephany,
Thanks for your response. I didn't expect it to not store a date.
I can type in a Time alone directly into a sql DateTime field. It will stay
in that format. I am assuming there is an offset here. Personally I prefer
not to separate date and time...unfortunately that isn't up to me here.
I need to retain the format as it was in access. I was expecting that I
might insert the Time as ‘01/01/1753 21:45’ to attain 9:45 PM in the table.
It seems that if I can enter it directly into the table that I should some
how be able to provide input to my typed dataset to replicate the behavior.
I also noticed that the Sql import was able to replicate this format.
I think this should be possible
If anyone has any ideas I would appreciate them
Thanks,
Jeff
"Stephany Young" wrote:
You have a misunderstanding of what the DateTime type is..
It NEVER contains just a date part.
It NEVER contains just a time part.
It ALWAYS contains both date and time parts.
When you come to use the value from the datatabale, YOU may expect only to
use the time part and format the result for display purposes accordingly.
Although the DateTime data type in a Jet database can contain values from
01/01/100 00:00:00 to to 31/12/9999 23:59:59, the datetime datatype in SQL
Server can only contain values from 01/01/1753 00:00:00.000 to 31/12/9999
23:59:59.997.
It is up to you to, before updating the datatable, to ensure that the
datetime variable has a valid datepart >= 01/01/1753.
"JeffDotNet" <JeffDotNet@xxxxxxxxxxxxxxxxx> wrote in message
news:89C0A3A5-994F-4C13-885B-F146F6D47E6B@xxxxxxxxxxxxxxxx
I have an application that needs to insert records into a datatable via a
typed dataset. We are in the process of moving from access to Sql 2000. A
copy of the table exists in access and in sql2000.
I now have 2 typed datasets one pointing to a table in access and one
pointing to an identical table in sql 2000. In this datatable there is a
DateTime field expected to have only a time in it. When I insert records
using the access dataset it works as expected
insert (myTime.ToShortTimeString,yada,yada,yada)
However the same call when using the sql 2000 dataset throws an exception
saying that the date is out of range. How can I supply my sql 2000 typed
dataset to insert just the Time into the datetime field. Do I need to
perform a date time subtraction?
Any help on this would be greatly appreciated,
Thanks,
Jeff
- Follow-Ups:
- Re: Typed dataset: Time only data in SQL dateTime Field
- From: WenYuan Wang
- Re: Typed dataset: Time only data in SQL dateTime Field
- From: Stephany Young
- Re: Typed dataset: Time only data in SQL dateTime Field
- References:
- Re: Typed dataset: Time only data in SQL dateTime Field
- From: Stephany Young
- Re: Typed dataset: Time only data in SQL dateTime Field
- Prev by Date: RE: Getting data from either MS Access or SQL based on Registry se
- Next by Date: RE: Problem showing datetime column in datagrid (Framework 1.1)
- Previous by thread: Re: Typed dataset: Time only data in SQL dateTime Field
- Next by thread: Re: Typed dataset: Time only data in SQL dateTime Field
- Index(es):
Relevant Pages
|
Loading