最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
根据数据库生成xml二法
时间:2022-07-02 11:48:42 编辑:袖梨 来源:一聚教程网
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: emp.xml");
==============================================================================
private void WriteXmlToFile(DataSet thisDataSet) {
if (thisDataSet == null) { return; }
// Create a file name to write to.
string filename = "myXmlDoc.xml";
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream
(filename, System.IO.FileMode.Create);
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicod
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: emp.xml");
==============================================================================
private void WriteXmlToFile(DataSet thisDataSet) {
if (thisDataSet == null) { return; }
// Create a file name to write to.
string filename = "myXmlDoc.xml";
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream
(filename, System.IO.FileMode.Create);
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicod
相关文章
- 光与夜之恋陪伴商店有什么更新 05-13
- 《塞尔达传说王国之泪》新手开荒心得分享 有什么心得? 05-13
- 热币网交易所官网版 05-13
- 无期迷途夜色将洇监察密令怎么玩 加洛法诺监察密令活动介绍 05-13
- 时空中的绘旅人炙情拭色礼包怎么样 炙情拭色特别礼包介绍 05-13
- 光与夜之恋陪伴商店有什么更新 光与夜之恋陪伴商店限时上新介绍 05-13