#region xml文件内容转化为DataSet
/// <summary>
/// xml文件内容转化为DataSet
/// </summary>
/// <param name="XmlFilePath"></param>
/// <returns></returns>
public static DataSet XmlToDataSet(string XmlFilePath)
{
DataSet ds = new DataSet();
ds.ReadXml(XmlFilePath);
return ds;
}
#endregion
#region DataSet保存为Xml文件
/// <summary>
/// DataSet保存为Xml文件
/// </summary>
/// <param name="ds"></param>
/// <param name="XmlFilePath">Xml文件的物理全路径</param>
/// <returns>返回错误提示信息,空表示没错误</returns>
public static string DataSetToXmlFile(DataSet ds, string XmlFilePath)
{
string ErrorString = "";
XmlDataDocument xd = new XmlDataDocument(ds);
xd.Save(XmlFilePath);
return ErrorString;
}
#endregion