c# 导出2007格式的Excel的连接字符串

       上次做了个导出excel文件的客户端软件,没有注意到:当打开2007版的excel时提示错误“外部表不是预期的格式”,刚才网上荡了点资料,改了一下连接字符串,问题解决了:

     把:string strConn = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + excel_filepath + "';Extended Properties='Excel 8.0;HDR=YES;IMEX=1'");//第一行作为列  

改为了:

string strConn = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;;Data Source='" + excel_filepath + "';Extended Properties='Excel 8.0;HDR=YES;IMEX=1'");//第一行作为列

原文地址:https://www.cnblogs.com/hanjiaxu/p/3239894.html