使用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"));

 

你可能感兴趣的:(document)