How To Convert String XML to Datatable in C# OR String XML to Datatset in Asp.Net
Program:
.Aspx File C#
Program:
.Aspx File 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://aspdotnet-suresh.com"); 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
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://aspdotnet-suresh.com") 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) |
No comments:
Post a Comment