本文介绍了将数据从Excel导入表时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试从excel导入数据到表时,出现以下错误:-
System.Data.dll中发生类型为"System.Data.OleDb.OleDbException"的异常,但未在用户代码中处理
附加信息:外部表的格式不正确.
我正在使用以下代码:-
Hi,
When I am trying to import data from excel to table it''s giving me following error :-
An exception of type ''System.Data.OleDb.OleDbException'' occurred in System.Data.dll but was not handled in user code
Additional information: External table is not in the expected format.
I am using following code:-
OleDbConnection excelConn = new OleDbConnection();
excelConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + filelocation + "';Extended Properties=Excel 8.0");
excelConn.Open();
推荐答案
这篇关于将数据从Excel导入表时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!