EDN Admin
Well-known member
im using xsd file to getxml from a dataset, but there is problem about datatime format.
the problem is in the xml i got from dataset.getxml, the xs:date field defined in xsd file was formatted to UTC time with timezone format, like this " <kpsj>2011-01-01T00:00:00+08:00</kpsj>". but what i want is <kpsj>2011-01-01</kpsj>
<br/>
DataSet ds1 = new DataSet();<br/>
ds1.ReadXmlSchema(txtXsdFile.Text); //reading xsd file<br/>
<br/>
//load data with xsd files define to dataset from anothe dataset<br/>
for(int i=0;i<ds.Tables[0].Rows.Count;i++)<br/>
ds1.Tables[0].ImportRow(ds.Tables[0].Rows);
<br/>
//get xml from the dataset<br/>
txtXML.Text = ds1.GetXml(); //this output the date string that was not desired.
/****/
i found there was a bug report for this problem years ago, but there was no answer to confirm that. i hate microsoft....
http://connect.microsoft.com/VisualStudio/feedback/details/507069/datasets-should-correctly-support-xsd-datatypes-xs-time-and-xs-date <span style="color:#0066dd http://connect.microsoft.com/VisualStudio/feedback/details/507069/datasets-should-correctly-support-xsd-datatypes-xs-time-and-xs-date
View the full article
the problem is in the xml i got from dataset.getxml, the xs:date field defined in xsd file was formatted to UTC time with timezone format, like this " <kpsj>2011-01-01T00:00:00+08:00</kpsj>". but what i want is <kpsj>2011-01-01</kpsj>
<br/>
DataSet ds1 = new DataSet();<br/>
ds1.ReadXmlSchema(txtXsdFile.Text); //reading xsd file<br/>
<br/>
//load data with xsd files define to dataset from anothe dataset<br/>
for(int i=0;i<ds.Tables[0].Rows.Count;i++)<br/>
ds1.Tables[0].ImportRow(ds.Tables[0].Rows);
<br/>
//get xml from the dataset<br/>
txtXML.Text = ds1.GetXml(); //this output the date string that was not desired.
/****/
i found there was a bug report for this problem years ago, but there was no answer to confirm that. i hate microsoft....
http://connect.microsoft.com/VisualStudio/feedback/details/507069/datasets-should-correctly-support-xsd-datatypes-xs-time-and-xs-date <span style="color:#0066dd http://connect.microsoft.com/VisualStudio/feedback/details/507069/datasets-should-correctly-support-xsd-datatypes-xs-time-and-xs-date
View the full article