|
-
July 19th, 2004, 03:23 PM
#1
DataSet with XML source and schema
Hi,
I need to use a DataSet with an XML source and an XML schema to fill a DataGrid.
In my schema, I have a date element (<xs:element name="date" type="xs:date"/>)
When I load the DataGrid with the DataSet, all my dates are showed like a date type.
After some changes, when I get my data from the DataSet (with MyDataSet.GetXml()), all my dates are datetime type even I specify "xs:date" in my schema.
date format : 2004-07-19
datetime format : 2004-07-19T14:43:25.6550000-04:00
Does anybody has an idea?
If you need some explanation, I can send you a big part of code.
Thanks
Gérard
-
July 20th, 2004, 12:33 AM
#2
 Originally Posted by frag0610
After some changes, when ...
What changes?
 Originally Posted by frag0610
If you need some explanation, I can send you a big part of code.
Please.
-
July 20th, 2004, 07:26 AM
#3
Changes
The changes are addition of new rows in DataGrid or modification of existing rows.
I have done the following test yesterday:
- I have added the schema to the DataSet (with ReadXmlSchema) and I have filled it with the XML source (with ReadXml).
- After this, I have executed (without change to the data) a GetXml in the Visual Studio command window. The result was that my dates had been changed to datetime.
Thanks for your time.
Gérard
-
July 20th, 2004, 09:17 AM
#4
The pattern for date is CCYY-MM-DD with optional time zone indicator as allowed for dateTime.
So it is date nevertheless.
-
July 20th, 2004, 09:48 AM
#5
Part of code
My problem is that I do not know the content (data and data type) of the DataSet ... so I am not sure that it will have a date inside.
The display in the DataGrid is correct. I think that the problem is only the DataSet.
When I see the type of DataSet columns in the debugger, the columns are always from System.DateTime type because the System.Date type does not exist !
I think that I need to check the elements type in the schema, to transform, if necessary, the data in good format.
This is a part of the code I use:
Dim oXmlTR As New XmlTextReader(MyXMLData)
If MyXSDFileName <> "" Then
'Add schema to DataSet
DataSet1.ReadXmlSchema(MyXSDFileName)
End If
'I don't need namespace in my application
DataSet1.Namespace = ""
'Add data to DataSet
DataSet1.ReadXml(oXmlTR)
Thanks for your time
Gérard
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|