SqlConnection conn = new SqlConnection();
connConnectionString = Server=;User ID=sa;Password=fdahgdrethj;Database=northwind;Persist Security Info=True;
connOpen();
SqlDataAdapter da = new SqlDataAdapter(select * from 表 conn);
SqlCommandBuilder thisBulder = new SqlCommandBuilder(da);
DataSet ds = new DataSet();
daFill(ds);
dsWriteXml(@C:\tempxml);
==============================================================================
private void WriteXmlToFile(DataSet thisDataSet) {
if (thisDataSet == null) { return; }
// Create a file name to write to
string filename = myXmlDocxml;
// Create the FileStream to write with
SystemIOFileStream myFileStream = new SystemIOFileStream
(filename SystemIOFileModeCreate);
// Create an XmlTextWriter with the fileStream
SystemXmlXmlTextWriter myXmlWriter =
new SystemXmlXmlTextWriter(myFileStream SystemTextEncodingUnicode);
// Write to the file with the WriteXml method
thisDataSetWriteXml(myXmlWriter);
myXmlWriterClose();
}