日期:2014-05-18  浏览次数:20923 次

关于DataSet.WriteXml保存路径的问题
private   void   WriteXmlFile(DataSet   ds)
{
if   (ds   ==   null)   {   return;   }

string   filename   =@ "Services.xml ";

System.IO.FileStream   myFileStream   =   new   System.IO.FileStream(filename,   System.IO.FileMode.Create);

System.Xml.XmlTextWriter   myXmlWriter   =   new   System.Xml.XmlTextWriter(myFileStream,   System.Text.Encoding.Unicode);

ds.WriteXml(myXmlWriter);      
myXmlWriter.Close();
 


}
这个保存,会把xml写到C盘哪里..怎么可以把它写到本目录下面..


------解决方案--------------------
string filename =Application.StartPath+@ "\Services.xml ";