Tuesday, October 28, 2008

Converting XML String to a Dataset in C#

using System.IO;

//Event
string a=gwObj.GetCitiesByCountry("India"); //This returns an xml string
StringReader sr = new System.IO.StringReader(a);
DataSet ds = new DataSet();
ds.ReadXml(sr);
dataGridView1.DataSource = ds.Tables[0];

comboBox1.DataSource = ds.Tables[0];
comboBox1.DisplayMember = "City";

this program displays the city inside the combo box

No comments: