DateTime vs Date in DataSet

  • Thread starter Thread starter moondaddy
  • Start date Start date
M

moondaddy

I have a webservice that returns a dataset with a Date datatype attribute in
it. The schema defines the attribute as a date datatype, but the WS returns
a datetime datatype and value as shown below:

From my schema:
<xs:attribute name="Or_DateCreated" type="xs:date" />

In schema returned in dataset:
<xs:attribute name="Or_DateCreated" form="unqualified" type="xs:dateTime" />

Data in dataset:
<tbOrder diffgr:id="tbOrder1" msdata:rowOrder="0" Or_ID="15" Or_Cu_ID="10"
Or_Lo_ID="13" Or_DateCreated="2003-08-01T16:20:32.5770000-05:00" xmlns="" />


Is there any way i can stip this attribute down to:
Or_DateCreated="2003-08-01"

?

Thanks.
 
Hi Moondaddy,

I have reproduced this problem. Because the data type in the database table
is contains time information, when filling the dataset, the DataAdapter
will guarantee that no information will be lost. Would you please tell me
why you need so remove the time information, so that I can try to find a
workaround for you?

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "moondaddy" <[email protected]>
| Subject: DateTime vs Date in DataSet
| Date: Tue, 14 Oct 2003 17:54:35 -0500
| Lines: 27
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: adsl-66-139-249-201.dsl.hstntx.swbell.net
66.139.249.201
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63657
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| I have a webservice that returns a dataset with a Date datatype attribute
in
| it. The schema defines the attribute as a date datatype, but the WS
returns
| a datetime datatype and value as shown below:
|
| From my schema:
| <xs:attribute name="Or_DateCreated" type="xs:date" />
|
| In schema returned in dataset:
| <xs:attribute name="Or_DateCreated" form="unqualified" type="xs:dateTime"
/>
|
| Data in dataset:
| <tbOrder diffgr:id="tbOrder1" msdata:rowOrder="0" Or_ID="15" Or_Cu_ID="10"
| Or_Lo_ID="13" Or_DateCreated="2003-08-01T16:20:32.5770000-05:00" xmlns=""
/>
|
|
| Is there any way i can stip this attribute down to:
| Or_DateCreated="2003-08-01"
|
| ?
|
| Thanks.
|
|
| --
| (e-mail address removed)
|
|
|
 
Why I need to remove the time information:
1) The added time information seems to be extra/unnecessary data going
across the wire
2) Because the table column in sql server which this data is being
inserted/updated to is datetime data type, it will except the time value
which I don't want in the table since I will get different results if I
group by the date value or filter by a date value (where col = '10-15-2003')
to name a few.
3) Since I don't use the time data for anything it just seems to get in the
way such as when I call data from the server and include this data in a
dropdown box it makes for a very messy appearance and is hard to read.
I know there are work arounds for most or all of these issues, but after
awhile it adds up to a lot of extra coding and trouble shooting. Therefore,
if there was a simple way to just force the data in this column to be a DATE
value, life would me much better.

Thanks for asking.

BTW: re: Because the data type in the database table is contains time
information...
yes, but I didn't input time data. I make sure that only date values
('10-15-2003') are input. I figure this is mostly an xml standards issue,
but I would be great if the dataset could overcome this limitation by
providing a true date element that would truncate any time data being input
into the column.
 
Hi moondaddy,

When filling the dataset with a DataAdapter, the schema information might
be overwrited by a schema in database, because Fill() method is so
generall, that it should avoid data loss in some instances. If you need to
add the dates to the list of a ComboBox, try to get each value with
dt.Date.ToShortDateString(). (dt is the DateTime type.) I think this might
be the workaround. Hope this helps.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "moondaddy" <[email protected]>
| References: <#[email protected]>
<[email protected]>
| Subject: Re: DateTime vs Date in DataSet
| Date: Thu, 16 Oct 2003 16:03:41 -0500
| Lines: 105
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: adsl-66-137-118-208.dsl.hstntx.swbell.net
66.137.118.208
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63811
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Why I need to remove the time information:
| 1) The added time information seems to be extra/unnecessary data going
| across the wire
| 2) Because the table column in sql server which this data is being
| inserted/updated to is datetime data type, it will except the time value
| which I don't want in the table since I will get different results if I
| group by the date value or filter by a date value (where col =
'10-15-2003')
| to name a few.
| 3) Since I don't use the time data for anything it just seems to get in
the
| way such as when I call data from the server and include this data in a
| dropdown box it makes for a very messy appearance and is hard to read.
| I know there are work arounds for most or all of these issues, but after
| awhile it adds up to a lot of extra coding and trouble shooting.
Therefore,
| if there was a simple way to just force the data in this column to be a
DATE
| value, life would me much better.
|
| Thanks for asking.
|
| BTW: re: Because the data type in the database table is contains time
| information...
| yes, but I didn't input time data. I make sure that only date values
| ('10-15-2003') are input. I figure this is mostly an xml standards issue,
| but I would be great if the dataset could overcome this limitation by
| providing a true date element that would truncate any time data being
input
| into the column.
|
|
| | > Hi Moondaddy,
| >
| > I have reproduced this problem. Because the data type in the database
| table
| > is contains time information, when filling the dataset, the DataAdapter
| > will guarantee that no information will be lost. Would you please tell
me
| > why you need so remove the time information, so that I can try to find a
| > workaround for you?
| >
| > If anything is unclear, please feel free to reply to the post.
| >
| > Kevin Yu
| > =======
| > "This posting is provided "AS IS" with no warranties, and confers no
| > rights."
| >
| > --------------------
| > | From: "moondaddy" <[email protected]>
| > | Subject: DateTime vs Date in DataSet
| > | Date: Tue, 14 Oct 2003 17:54:35 -0500
| > | Lines: 27
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <#[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.adonet
| > | NNTP-Posting-Host: adsl-66-139-249-201.dsl.hstntx.swbell.net
| > 66.139.249.201
| > | Path:
| >
|
cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
| > 8.phx.gbl!tk2msftngp13.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.adonet:63657
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| > |
| > | I have a webservice that returns a dataset with a Date datatype
| attribute
| > in
| > | it. The schema defines the attribute as a date datatype, but the WS
| > returns
| > | a datetime datatype and value as shown below:
| > |
| > | From my schema:
| > | <xs:attribute name="Or_DateCreated" type="xs:date" />
| > |
| > | In schema returned in dataset:
| > | <xs:attribute name="Or_DateCreated" form="unqualified"
| type="xs:dateTime"
| > />
| > |
| > | Data in dataset:
| > | <tbOrder diffgr:id="tbOrder1" msdata:rowOrder="0" Or_ID="15"
| Or_Cu_ID="10"
| > | Or_Lo_ID="13" Or_DateCreated="2003-08-01T16:20:32.5770000-05:00"
| xmlns=""
| > />
| > |
| > |
| > | Is there any way i can stip this attribute down to:
| > | Or_DateCreated="2003-08-01"
| > |
| > | ?
| > |
| > | Thanks.
| > |
| > |
| > | --
| > | (e-mail address removed)
| > |
| > |
| > |
| >
|
|
|
 
Back
Top