急!关于利用c# 读取sql2000数据库的数据为xml格式的文件
下面是“按钮”控件下的代码 目的是读取 sql2000数据库中数据 输出格式为xml的文件
string sqlstr = " select data,discountno,discountname,productno,productname,quantity,price,pihao,unit,type ,accountno,accountname from tslmsyy for xml Auto ";
//Query(sqlstr);
//string yiyao = "XMLFile.xml";
SqlDataAdapter sda = new SqlDataAdapter(sqlstr, mydb.getcon());
DataSet ds =new DataSet ();
sda .Fill (ds,"dstable");
ds.ReadXml(Server.MapPath("./") + "XMLFile.xml"); //+ "/web.config");
DataTable tb=new DataTable ();
DataView dv=new DataView ();
tb = ds.Tables["dstable"] ;
dv=new DataView (tb);
this.GridViewyy.DataSource =dv;
this .GridViewyy .DataBind ();
gridviewread();
或许那位有更好的源代码,请共享一下,谢谢