string sql = "Select Top 10 F_ID,F_Name From T_Product";
DataSet Ds = Database.ExecuteDataset(conn, CommandType.Text, sql);
Ds.WriteXml("c:\\test.xml", XmlWriteMode.WriteSchema);//将数据输出到xml
DataSet Ds2 = new DataSet();
Ds2.ReadXml("c:\\test.xml");//将xml加载到DataSet
this.GridView1.DataSource = Ds2.Tables[0].DefaultView;
this.GridView1.DataBind();
时间: 2024-11-18 03:30:54