Loading an XML string in a DataSet (.NET 2.0)

Today, I found a way to read an XML String into a dataset. The scenario is as follow:
I have a Database table, which contains a XML column(holds an XML instance based on a perticular schema). I want to load this XML in a dataset so that user can manipulate this XML using my UI. To do so , I did following in C#.NET 2.0.
DataSet dataSet = new DataSet();
string xmlData = getValuefromDB(ParamColumn);
System.IO.StringReader xmlSR = new System.IO.StringReader(xmlData);
dataSet.ReadXml(xmlSR, XmlReadMode.IgnoreSchema);

In this code, getValuefromDB is my own function, which return the XML string by reading the ‘ParamColumn’ in the Database Table.
This is a very useful information as on internet, when you search for reading XML into dataset, you will get references for reading an XML File. But in a situation where you don’t have a file and you have only an XML string, you need this method.
I hope you can utilize this approach in your development.

Skip to main content