Kumpulan Data publik GetData(string httpUrl)
{
string xmlPath = @"http地址"; // 该地址不能包含中文
Kumpulan Data ds = Kumpulan Data baru();
Klien Web wc = Klien Web baru();
byte[] bt = wc.DownloadData(xmlPath);
XmlDocument xd = XmlDocument baru();
sumber string = Byte2String(bt);
xd.LoadXml(sumber);
XmlNodeReader xnr = XmlNodeReader baru(xd);
ds.ReadXml(xnr);
DataTable dt = ds.Tabel[0];
ini.DataGrid1.DataSource = ds;
ini.DataGrid1.DataBind();
kembali ds;
}
string statis publik Byte2String(byte[] bt)
{
System.Text.Encoding pengkodean = System.Text.Encoding.GetEncoding("gb2312");
string str = pengkodean.GetString(bt);
kembalikan str;
}
Alamat: http://www.brtech.com.cn