先看看Excel的:
public abstract class Xls
{
//此连接只能操作Excel2007之前(.xls)文件
//private static readonly string strConn = "Provider=Microsoft.Jet.OleDb.4.0;data source={0};Extended Properties='Excel 8.0; HDR={1}; IMEX=1'";
//此连接可以操作.xls与.xlsx文件
private static readonly string strConn = "Provider=Microsoft.Ace.OleDb.12.0;data source={0};Extended Properties='Excel 12.0; HDR={1}; IMEX=1'";
//获取完整的路径
private static string FileFullPath ( string FillName ){
return System.Web.HttpContext.Current.Request.PhysicalApplicationPath +"UpLoad\\"+ FillName; //完整路径需要加上文件名。
}
/// <summary>
/// GetExcelToDataTableBySheet方法的重载,默认hdr参数为YES
/// </summary>
public static DataTable GetExcelToDataTableBySheet(string FilePath, string She