www.pudn.com > startprepare.rar > ManageSysLogs.cs
using System;
namespace DS.EMIS.StartPrepare.Common
{
///
/// ManageSysLogs 的摘要说明。
///
internal class ManageSysLogs
{
public ManageSysLogs()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* <表名>
* <字段名1>值字段名1>
* <字段名2>值字段名2>
* 表名>
* <表名>
* <字段名1>值字段名1>
* <字段名2>值字段名2>
* 表名>
*
*
*/
public System.Data.DataSet ReadDataFromDataFile(string fileName)
{
System.Data.DataSet dsReturn =null;
try
{
string currAppPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
System.IO.StreamReader fsReadMXL = new System.IO.StreamReader(currAppPath + ".\\SysData\\"+fileName,System.Text.Encoding.GetEncoding("gb2312"));
dsReturn= new System.Data.DataSet("LocalConfig");
dsReturn.ReadXml(fsReadMXL);
fsReadMXL.Close();
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}
return dsReturn;
}
public void WriteDataToDataFile(string fileName,System.Data.DataSet dataSet)
{
try
{
string currAppPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
System.IO.StreamWriter myFileName = new System.IO.StreamWriter(currAppPath + ".\\SysData\\"+fileName,false,System.Text.Encoding.GetEncoding("gb2312"));
dataSet.WriteXml( myFileName,System.Data.XmlWriteMode.IgnoreSchema);
myFileName.Close();
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}
}
}
}