Before doing DataTable and dataset-to-XML has been done using XmlSerializer serialization. Today I found a new method, wow, a lot of convenience. Don't worry about the name empty times wrong
1 Static voidMain (string[] args)2 {3DataTable dt =NewDataTable ();4Dt. TableName ="DTABC";5Dt. Columns.Add ("Cloumna");6Dt. Columns.Add ("CLOUMNB");7Dt. Columns.Add ("CLOUMNC");8 9DataRow dr =dt. NewRow ();Tendr["Cloumna"] ="AAA"; Onedr["CLOUMNB"] ="BBB"; Adr["CLOUMNC"] ="AAA"; - - dt. Rows.Add (DR); theDataSet ds =NewDataSet (); -Ds. DatasetName ="DSABC"; - ds. Tables.add (DT); - + stringXML = ds. GETXML ();//DataSet serialized into XML - //string xml2 = ds. GetXmlSchema (); + ADataSet DS2 =NewDataSet ("dsnew"); at -StringReader stream =NewStringReader (XML);//XML deserialized into a dataset -XmlTextReader reader =NewXmlTextReader (stream); - DS2. READXML (reader); -}
Conversion of Datatable/dataset and XML to each other