C# 如何获取指定路径下的Excel文件并转换成DataTable?oledbdataadapter
Provider=Microsoft.Jet.OLEDB.4.0;DataSource="ExtendedProperties=Excel8.0"stringsql="select*from[Sheet1$]"OleDbDataAdapterda=newOleDbDataAdapter(sql;conn);
C# 如何获取指定路径下的Excel文件并转换成DataTable?
publicDataSetImportExcel(stringstrFileName)//strFileName指定的路径+文件名.xls{if(strFileName!=""){stringconn="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+strFileName+";ExtendedProperties=Excel8.0"
;stringsql="select*from[Sheet1$]";OleDbDataAdapterda=newOleDbDataAdapter(sql,conn)
0