Thanks
Converting Datatable to xml string and viceversa
XML is a simple and flexible system for defining data formats. This is completely platform independent and adopted everywhere for representing complex documents and data structures. For data transmission on web, its having significant contribution. It is very common to use dataset in .NET applications. A dataset may contain a single table or multiple tables that are related though primery and foreign keys. We can also use XML to completely reconstruct the dataset. Now days it's been the major use of XML to store both row set i.e single table and hierarchical i.e. multiple-table data in it.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Lalit MRank #1,186 · 1.5K reputationPosted Feb 3, 2010, 1:43 AM EST
Converting Datatable to xml string show code sample here private static string ConvertDataTableToXML(DataTable dtBuildSQL) { DataSet dsBuildSQL = new DataSet(); StringBuilder sbSQL; StringWriter swSQL; string XMLformat; sbSQL = new StringBuilder(); swSQL = new StringWriter(sbSQL); dsBuildSQL.Merge(dtBuildSQL, true, MissingSchemaAction.AddWithKey); dsBuildSQL.Tables[0].TableName = "Table"; foreach (DataColumn col in dsBuildSQL.Tables[0].Columns) { col.ColumnMapping = MappingType.Attribute; } dsBuildSQL.WriteXml(swSQL, XmlWriteMode.WriteSchema); XMLformat = sbSQL.ToString(); return XMLformat; } more info