XML文件导入、导出到 DataSet
时间:2010-09-09 来源:quietwalk
//导出dataset数据到XML文件
//Author:Quietwalk
//2010-09-09
public bool ExportToXMl(DataSet ds, string strXMLPath)
{
//DirectoryInfo mobileDir = new DirectoryInfo(strXMLPath);
FileInfo XMLfile = new FileInfo(strXMLPath);
bool bReturnValue = false;
try
{
if (ds != null && ds.Tables.Count > 0 && XMLfile.Exists)
{
ds.WriteXml(strXMLPath, XmlWriteMode.WriteSchema);
bReturnValue = true;
}
}
catch(SqlCeException ex)
{
throw(ex);
}
return bReturnValue;
}
//XML 数据导入到 DataSet中
//Author:Quietwalk
//2010-09-09
public DataSet ImportFromXml(string fromPath)
{
FileInfo xmlFile = new FileInfo(fromPath);
DataSet dsXML =null;
if (xmlFile.Exists)
{
FileStream fsReadXml = new FileStream(fromPath, FileMode.Open);
XmlTextReader myXmlReader = new XmlTextReader(fsReadXml);
dsXML=new DataSet ();
dsXML.ReadXml(myXmlReader);
myXmlReader.Close();
}
return dsXML;
}
- 系统休眠文件删除后果 如何删除计算机的休眠文件 2025-04-22
- 站群服务器是什么意思 站群服务器的作用 站群服务器和普通服务器的区别 2025-04-22
- jQuery插件有何作用 jQuery插件的使用方法 2025-04-22
- jQuery插件有哪些种类 简单的jQuery插件实例 2025-04-22
-