public DataSet GetData(string httpUrl)
{
string xmlPath = @"http地址"; // 该地址不能包含中文
DataSet ds = new DataSet();
WebClient wc = new WebClient();
byte[] bt = wc.DownloadData(xmlPath);
XmlDocument xd = new XmlDocument(); 字串2
string source = Byte2String(bt);
字串3
xd.LoadXml(source); 字串3
XmlNodeReader xnr = new XmlNodeReader(xd);
字串4
ds.ReadXml(xnr);
DataTable dt = ds.Tables[0]; 字串7
字串8
this.DataGrid1.DataSource = ds;
this.DataGrid1.DataBind();
字串8
return ds; 字串5
} 字串7
字串1
public static string Byte2String(byte[] bt) 字串6
{ 字串9
System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("gb2312");
字串4
string str = encoding.GetString(bt); 字串7
return str; 字串6
}
出处:http://www.brtech.com.cn
字串3