Here I will explain how to convert xml string to dataset or xml string to datatable in Asp.Net using C# And Vb.Net
C#
C#
WebClient web = new WebClient();
string url = string.Format("https://api.facebook.com/method/fql.query?query=SELECT url, share_count, like_count, comment_count, total_count, click_count FROM link_stat where url=http://collageprogramming.blogspot.in");
string response = web.DownloadString(url);
DataSet ds = new DataSet();
using (StringReader stringReader = new StringReader(response))
{
ds=new DataSet();
ds.ReadXml(stringReader);
}
DataTable dt = ds.Tables[0];
Vb.Net
Dim web As New WebClient()
Dim url As String = String.Format("https://api.facebook.com/method/fql.query?query=SELECT url, share_count, like_count, comment_count, total_count, click_count FROM link_stat where url=http://collageprogramming.blogspot.in/")
Dim response As String = web.DownloadString(url)
Dim ds As New DataSet()
Using stringReader As New StringReader(response)
ds = New DataSet()
ds.ReadXml(stringReader)
End Using
Dim dt As DataTable = ds.Tables(0)
Great conversion tips for string xml to datatable using vb.net.
ReplyDeleteASP.Net Migration
Convert VB to C# with VBConversions,the most accurate code translation tool available.more information then visit: www.vbconversions.com
ReplyDeletevb.net to c#
Convert your VB programs to C# with over 99% accuracy with the VBConversions VB.Net to C# Converter, the most accurate VB.Net to C# Converter available. It won the coveted Visual Studio Magazine Reader's Choice Award in the developer tools category. It was chosen by real world developers in the field just like you. A free download is available at www.vbconversions.com.
ReplyDeletevb.net to c# converter