February 19, 2004

XML to DataSet to DataGrid

Code snippet to convert XML in DataSet and then using it with Datarid:

private void xmlToDataSet(string sXML){

DataSet ds = new DataSet();
StringReader rdr;

// Create a StringReader with xml
rdr = new StringReader(sXML);

// read XML into a DataSet

//Bind DataGrid (dg) to show what was in the XML string
dg.DataSource = ds;