Sunday, October 27, 2013

Convert Dataset to xml string using C#

In my previous post i explained, Save images to database using SQL. Count string occurrence and much more articles realted with, SQL. Now in this article i will going to explain how to Convert the dataset to xml string using  C# and 

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);


string strUserDetails = dsUser.GetXml();

Its very simple and easy method. Please post your comments for any suggestion.

No comments:

Post a Comment