In my previous post i explained, Save images to database using SQL. Count string occurrence and much more articles realted with asp.net, SQL. Now in this article i will going to explain how to Convert the dataset to xml string using C# and asp.net
below is the short and sweet way to convert the dataset into xml.
DataSet dsUser = new DataSet();
SqlCommand cmdSelect = new SqlCommand("select name,age,location,ph,cell,status from userDetails ", conn);
SqlDataAdapter sda = new SqlDataAdapter(cmdSelect);
da.Fill(dsUser);
string strUserDetails = dsUser.GetXml();
Its very simple and easy method. Please post your comments for any suggestion.