|
 |
资料搜索 |
|
|
|
|
|
|
|
 |
相关文章 |
|
|
|
|
|
|
|
|
|
|
| [ 来源:中国软件 | 作者:无从考证 | 时间:2005-8-23 20:17:53 | 浏览:人次 ] | |
|
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) {
 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.Unicode);
// Write to the file with the WriteXml method.
thisDataSet.WriteXml(myXmlWriter);
myXmlWriter.Close();
}
|
|
|
|
|
|
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
|
|
|
|
|
栏目编辑: 设计风 |
责任编辑: 郁郁小蝎 |
|
|
原始作者: 无从考证 |
录入时间: 2005-8-23 20:17:53 |
|
|
信息来源: 中国软件 |
投稿信箱: Edu#chinaz.com |
|
|
|
| |
|