将数据从Excel导入表时出错 [英] Error while importing data from excel to table

查看:95
本文介绍了将数据从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();

推荐答案

请参见 http://forums.asp.net/p/993765/1295805.aspx [ ^ ]

查看 triloki 的回复.
See http://forums.asp.net/p/993765/1295805.aspx[^]

Check out the reply from triloki.


这篇关于将数据从Excel导入表时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆