/// <summary>
/// 读取XML文件
/// </summary>
/// <param name="fileName"></param>
public string TestReadXMLFile(string fileName)
{
try
{
DataSet objDataSet = new DataSet();
string filepath = System.Web.HttpContext.Current.Server.MapPath("~/CatitalXML");
objDataSet.ReadXml(filepath + "/" + fileName + ".XML");
//第一种方式
//dgEmployees.DataSource = objDataSet;
//dgEmployees.DataBind();
//第二种方式
//dgEmployees.DataSource = objDataSet.Tables["Ad"].DefaultView;
//dgEmployees.DataBind();
return "成功";
}
catch (Exception ex)
{
return "失败";
}
}
原文地址:https://www.cnblogs.com/nayilvyangguang/p/9981529.html
时间: 2024-10-05 05:07:43