特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> ASP.NET教程> 利用WebClient获取远程数据(仅做备份)

利用WebClient获取远程数据(仅做备份)

时间:2009-06-30 16:05:01 作者:互联网

public DataSet GetData(string httpUrl)
              {
                     string xmlPath = @"http地址"; // 该地址不能包含中文
                     DataSet ds = new DataSet();
                     WebClient wc = new WebClient();
                     byte[] bt = wc***wnloadData(xmlPath); 
                     XmlDocument xd = new XmlDocument();

                     string source = Byte2String(bt);

                     xd***adXml(source);

                     XmlNodeReader xnr = new XmlNodeReader(xd);

                     ds***adXml(xnr);

 

                     DataTable dt = ds***bles[0];

 

                     th***DataGrid1.DataSource = ds;

                     th***DataGrid1.DataBind();
  

                     return ds;  

              }

 

              public static string Byte2String(byte[] bt)

              {

                     Sy***m.Text.Encoding encoding = Sy***m.Text.Encoding.GetEncoding("gb2312");

                     string str = en***ing.GetString(bt);

                     return str;

              }


       
出处:http://www.brtech.com.cn

相关文章 最新文章

相关应用

热门文章

猜你喜欢

返回顶部