使用XmlDataDocument将数据存储到XML文档

 string str = "Data Source=192.168.1.20;Initial Catalog=WebTest;User ID=sa;Password=";
        SqlConnection conn = new SqlConnection(str);
        string sel = "select * from Table_A";
        SqlDataAdapter da = new SqlDataAdapter(sel, conn);
        DataSet ds = new DataSet();
        da.Fill(ds,"stu");
        XmlDataDocument xdd = new XmlDataDocument(ds);
        string ss = Server.MapPath("stu.xml");
        xdd.Save(Server.MapPath("stu.xml"));

 

posted @ 2013-07-29 15:25  陈海波  阅读(254)  评论(0编辑  收藏  举报