Introduction: In this article we'll see how to specify the format of DateTime values extracted from the ADO.NET DataSet and to verify we will write formatted contents in xml file.
A DataSet has capability to read, write data and schema as XML documents.
To generate the DataSet to have a customized format of DateTime or Date/Time the solution is to manipulate the data by using GetXml,XmlTextReader and XmlTextWriter.
Solution:
The steps that we would follow:
Code as given below:
Namespaces used:
SqlConnection mycn;SqlDataAdapter myda;DataSet ds;String strConn;
XTWriter.WriteString(XmlConvert.ToDateTime(XTReader.Value).ToString());
Output of webform shown belowThe Xml generated is as follows:
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: