将Excel数据转换成数据表 [英] Excel Data into datatable

查看:89
本文介绍了将Excel数据转换成数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遇到一种方案,其中我必须从excel到datatable中提取数据.
但是每次都会出现外部表未采用预期格式"的错误
谁能告诉我如何解决这个问题.???

I am Having Scenario in which i have to fetch data from excel to datatable.
But Everytime Error is coming that ''External table is not in Expected Format''
Can anyone tell me how to overcome this.???

推荐答案

这些链接可能会帮助您-
外部表的格式不正确. [ ^ ]
从Excel读取时,外部表未采用预期格式 [
These links might help you out -
External table is not in the expected format.[^]
External table is not in the expected format while reading from Excel[^]


请参阅最近发表的这篇文章中的GetConnectionString 方法: Microsoft Access数据库引擎2010可再发行.
Look at the GetConnectionString method in this recently posted article: Dynamic Excel file loading with SSIS.
It builds the connection string for the particular excel file supplied and works for me.
Take into account that sometimes the Microsoft.Ace.OLEDB.12.0 provider is not registered on the computer and you must download and install it: Microsoft Access Database Engine 2010 Redistributable.



试试这个将指导您.
Hi ,
Try this will Guide you .
if (!IsPostBack)
      {
          String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Book1.xls;Extended Properties=\"Excel 8.0;Readonly=False;IMEX=0;\"";


          using (OleDbConnection objConn = new OleDbConnection(sConnectionString))
          {
              objConn.Open();

              using (OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM [Info


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

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