【 tulaoshi.com - ASP.NET 】
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Server=127.0.0.1;User ID=sa;Password=fdahgdrethj31313210212121;Database=northwind;Persist Security Info=True";
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from 表", conn);
SqlCommandBuilder thisBulder = new SqlCommandBuilder(da);
DataSet ds = new DataSet();
da.Fill(ds);
ds.WriteXml(@"C:temp.xml");
==============================================================================
private void WriteXmlToFile(DataSet thisDataSet)
来源:http://www.tulaoshi.com/n/20160129/1490388.html