Asp.Net讀取excel文件的時候 出錯提示:外部表不是預期的格式

鏈接出處http://blog.csdn.net/abandonship/archive/2010/01/15/5193498.aspx

錯誤原因1: 由於Excel's 97-2003的連接格式與Excel's 2007 的 不同造成。
解決方案1:

            原Excel's 97-2003的連接串:
            sbInfo.Append(@"Provider= Microsoft.Jet.OLEDB.4.0; Data Source =");
            sbInfo.Append(帶路徑Excel文件);
            sbInfo.Append(";Extended Properties=Excel 8.0");


            Excel's 2007的連接串:            
            sbInfo.Append(@"Provider=Microsoft.Ace.OLEDB.12.0;Data Source=");
            sbInfo.Append(帶路徑Excel文件);
            sbInfo.Append(";Extended Properties=Excel 12.0;");

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章