Re: Typed dataset: Time only data in SQL dateTime Field
- From: JeffDotNet <JeffDotNet@xxxxxxxxxxxxxxxxx>
- Date: Mon, 22 Jan 2007 08:22:02 -0800
Thanks Wen and Stephany,
This is indeed what I was looking for.
Dim SqlTimeOnly As Date = #12/30/1899#
SqlTimeOnly = SqlTimeOnly.Add(MyTime.TimeOfDay)
MyTableAdapter.Insert(sqlTimeOnly,yada,yada,yada)
This does in fact produce the outcome I wanted. When displaying the table
after insert only the time appears.
Thanks Again,
Jeff
"WenYuan Wang" wrote:
Hi Jeff,.
I agree with Stephany. The DateTime filed always contains both date and
time parts. I'm afraid that it is not possible for us to only insert time
into DateTime type column. SQL Server inserts midnight (00:00:00) when time
information is missing, and 1900-01-01 when date information is missing.
But, under my test, in SQL 2000 if we set the date information to
"1899-12-30" SQL database will only display the time part of the field.
This is similar that you directly insert time into table by SQL Server
Enterprise Manager. I think maybe this is what you want.
For example:
Insert TableName into ([c1,c2]) values (1,' 1899-12-30 18:00')
In SQL database, the table will only show the time part of the field.
If you don't want to insert the day part into table, we suggest you can set
the date information to "1899-12-30".
I think this is the workaround to your issue.
Hope this will help.
Sincerely,
Wen Yuan
- Follow-Ups:
- 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
- From: JeffDotNet
- Re: Typed dataset: Time only data in SQL dateTime Field
- From: WenYuan Wang
- Re: Typed dataset: Time only data in SQL dateTime Field
- Prev by Date: Re: TableAdapters and Transactions again!
- Next by Date: Re: Typed dataset: Time only data in SQL dateTime Field
- 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
|