Introduction:
Description:
In previous posts I explained Convert datatable to xml in asp.net, asp.net, C#, SQL Server Interview Questions, jQuery validate file extension in file upload control, send forgot password as email in asp.netand many articles relating to asp.net, C#, VB.NET code snippets. Now I will explain how to convert dataset to xml string in asp.net using C#, VB.NET.
C# Code
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand("select * from usersInfo", con);
SqlDataAdapter da=new SqlDataAdapter(cmd);
da.Fill(ds);
string str = ds.GetXml();
|
VB.NET Code
Dim ds As New DataSet()
Dim cmd As New SqlCommand("select * from usersInfo", con)
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
Dim str As String = ds.GetXml()
|
No comments:
Post a Comment