public DataSet GetData(string httpUrl) string source = Byte2String(bt); xd.LoadXml(source); XmlNodeReader xnr = new XmlNodeReader(xd); ds.ReadXml(xnr); DataTable dt = ds.Tables[0]; this.DataGrid1.DataSource = ds; this.DataGrid1.DataBind(); return ds; } public static string Byte2String(byte[] bt) { System.Text.Encoding encoding = System.Text.Encoding.GetEncoding(“gb2312”); string str = encoding.GetString(bt); return str; }
{
string xmlPath = @”http地址”; // 该地址不能包含中文
DataSet ds = new DataSet();
WebClient wc = new WebClient();
byte[] bt = wc.DownloadData(xmlPath);
XmlDocument xd = new XmlDocument();
利用webclient获取远程数据(仅做备份) _asp.net技巧
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 利用webclient获取远程数据(仅做备份) _asp.net技巧
相关推荐
- 暂无文章
