DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: hebhanax
今日帖子: 49
在线用户: 14
导航: 论坛 -> 数据库专区 斑竹:liumazi,waterstone  
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/11 20:39:53
标题:
求救:SQL Server 2008/2019 导入 Excel 文件 浏览:2571
加入我的收藏
楼主: 以前有从 Excel 文件导入数据到 SQL Server 2008,而且是成功的,今天不知为何不行了。百度了一圈,全是要安装AccessDatabaseEngine,但根本不行,以前我也没额外装过它。
提示如下截图:
此帖子包含附件:
PNG 图像
大小:7.3K
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/11 20:40:56
1楼: 现在我把 SQL Server 2008 卸载了,重装了 2019的,还是不行,同样的错误提示。
----------------------------------------------
-
作者:
男 supermay (supermay) ★☆☆☆☆ -
盒子活跃会员
2020/9/12 10:06:11
2楼: 安装MDAC,
AccessDatabaseEngine
----------------------------------------------
链接:https://pan.baidu.com/s/12jzmECYKhGCsHBxz8tmB6w 提取码:pelr --来自百度网盘超级会员V9的分享
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/12 10:23:22
3楼: AccessDatabaseEngine 已经装了,没用
----------------------------------------------
-
作者:
男 ksrsoft (cb168) ★☆☆☆☆ -
普通会员
2020/9/12 17:31:43
4楼: Excel我都当CSV导入
----------------------------------------------
-
作者:
男 keymark (嬲) ▲▲▲△△ -
普通会员
2020/9/12 23:10:19
5楼: File Type (extension)          Extended Properties
----------
Excel 97-2003 Workbook (.xls)          "Excel 8.0"
Excel Workbook (.xlsx)          "Excel 12.0 Xml"
Excel Macro-enabled workbook (.xlsm)      "Excel 12.0 Macro"
Excel Non-XML binary workbook (.xlsb)      "Excel 12.0"

2016


Note: Before installing this download, you must first remove any previous versions of the Access Database Engine from your computer by using Add/Remove Programs in the Control Panel.

To install this download:
Download the file by clicking the Download button and saving the file to your hard disk.
Double-click the AccessDatabaseEngine.exe program file on your hard disk to start the setup program.
Follow the instructions on the screen to complete the installation.
To use this download:
If you are the user of an application, consult your application documentation for details on how to use the appropriate driver.
If you are an application developer using OLEDB, set the Provider argument of the ConnectionString property to “Microsoft.ACE.OLEDB.12.0”

If you are connecting to Microsoft Office Excel data, add the appropriate Extended Properties of the OLEDB connection string based on the Excel file type:

File Type (extension)          Extended Properties
----------
Excel 97-2003 Workbook (.xls)          "Excel 8.0"
Excel 2007-2010 Workbook (.xlsx)          "Excel 12.0 Xml"
Excel 2007-2010 Macro-enabled workbook (.xlsm)      "Excel 12.0 Macro"
Excel 2007-2010 Non-XML binary workbook (.xlsb)      "Excel 12.0"

If you are an application developer using ODBC to connect to Microsoft Office Access data, set the Connection String to “Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path to mdb/accdb file”
If you are an application developer using ODBC to connect to Microsoft Office Excel data, set the Connection String to “Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=path to xls/xlsx/xlsm/xlsb file”
To remove this download:
To remove the download file itself, delete the file AccessDatabaseEngine.exe
On the Start menu, point to Settings and then click Control Panel.
Double-click Add/Remove Programs.
In the list of currently installed programs, select “Microsoft Access database engine 2010” and then click Remove or Add/Remove. If a dialog box appears, follow the instructions to remove the program.
Click Yes or OK to confirm that you want to remove the program.

2010
----------------------------------------------
[alias]  co = clone --recurse-submodules  up = submodule update --init --recursiveupd = pullinfo = statusrest = reset --hard懒鬼提速https://www.cctry.com/>http://qalculate.github.io/downloads.htmlhttps://www.cctry.com/
作者:
男 c5soft (大道至简) ▲▲▲▲▲ -
普通会员
2020/9/14 8:28:39
6楼: 一直在SQL Server中直接访问Excel的WorkSheet, 可将WorkSheet或命令区域视同SQL Server内部表,还可以与SQL Server内部表JOIN混合查询。

要点:
1.安装AccessDatabaseEngine,分32位与64位的,与SQL Server版本要一致;
2.在SQL Server中建立Linked Server指向Excel的WorkBook
3.执行 EXEC sp_tables_ex 'LinkedServerName' 检查连接是否成功
----------------------------------------------
-
作者:
男 blacktulip (blacktulip) ★☆☆☆☆ -
盒子活跃会员
2020/9/15 10:25:40
7楼: AccessDatabaseEngine 分32位 和 64位 不行你就两个版本都装下
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/15 18:16:29
8楼: 都是64位的(试过装32位,提示该版本不适用),我两台电脑,一台工作,一台家用,系统、软件版本环境完全一样。原本两台都没有安装AccessDatabaseEngine,只装了office 2019,sql server 2019和XE 10.3.3,两台都可以从excel导入数据。现在唯一区别是工作机装的是绿色 XE 10.4.1,家用机是用原版ISO安装。
工作机无法从EXCEL导入数据,家用机可以从EXCEL导入,家用机从没装过AccessDatabaseEngine。工作机安装了AccessDatabaseEngine也仍无法导入excel.

所以我现在怀疑是绿化版 XE 10.4.1 导致的。
装了绿化版后隔了一个多星期我才又从EXCEL导入,才发现异常,所以也只能是怀疑。
----------------------------------------------
-
作者:
男 sxqwhxq (步惊云) ★☆☆☆☆ -
普通会员
2020/9/15 19:19:52
9楼: xlsreadwriteII5 or flexcel是导入excel数据的最佳选择,无须安装excel,也无须关注用户机环境,程序发布后不再维护。
----------------------------------------------
-
作者:
男 c5soft (大道至简) ▲▲▲▲▲ -
普通会员
2020/9/16 9:36:33
10楼: 我现在使用电脑操作系统Win10 64位,装的就是Delphi 10.4.1绿色版,SQL Server是2012,Select Excel数据妥妥的,insert与update也是妥妥的。应该与Delphi无关,SQL Server 通过AccessDatabaseEngine操作Excel使用的是OleDB接口, 与Delphi关系不大。
----------------------------------------------
-
作者:
男 c5soft (大道至简) ▲▲▲▲▲ -
普通会员
2020/9/16 10:16:11
11楼: 用xlsreadwriteII5 、 flexcel、NativeExcel、XlsGen等Delphi控件导入 Excel数据,与在SQL Server内部操作Excel来对比,应该是各有优劣。

通过OleDB接口在SQL Server服务器端直接访问Excel,有着极大的灵活性,对于熟悉SQL语句的编程人员,能够发挥SQL语句的强大威力,无需Delphi编程,几条SQL语句就把事情办了。重点是能给予Excel的WorkSheet与SQL Server的Table同样待遇,通过 JOIN 做关联查询,这点太实用了。

顺便说说xlsreadwriteII5 、 flexcel、NativeExcel、XlsGen等Delphi控件,轮速度,从我几年前曾做过测试来看,后边两个的读写速度明显快于前面两个,可惜NativeExcel停止开发了,源代码能够找到的是Version 3.0.26 29-Nov-2011,Excel稳定支持只能是老版的xls格式,如今是xlsx大行天下了;XlsGen一直在更新,速度不亚于NativeExcel, 唯一的问题是要付费,网上也曾流出过破解版,版本比较老。
----------------------------------------------
-
作者:
男 grjs_2004 (grjsITname) ★☆☆☆☆ -
盒子活跃会员
2020/9/16 11:31:54
12楼: 登录数据库管理器,依次打开,连接服务器-->访问接口-->选择“Microsoft.ACE.OLEDB.XX”-->右键-->属性-->常规-->右边的【访问接口选项】,一般勾选:动态参数,嵌套查询,运行进程内,支like运算,这几项就可以了
----------------------------------------------
Everyone will to do best!
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 9:08:57
13楼: @grjs_2004
已按你说的设置,仍无法报异常
此帖子包含附件:
PNG 图像
大小:30.4K
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 9:09:29
14楼: 16的也设置了
此帖子包含附件:
PNG 图像
大小:30.4K
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 9:09:52
15楼: 导入仍异常
此帖子包含附件:
PNG 图像
大小:37.6K
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 9:10:18
16楼: 用16的ACE也不行
此帖子包含附件:
PNG 图像
大小:37.2K
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 9:12:41
17楼: @grjs_2004
我怀疑是machine.config的配置坏了,但我不懂改!

    <system.data>
        <DbProviderFactories/>
      <DbProviderFactories>
        <add name="BlackfishSQL Local Provider" invariant="Borland.Data.BlackfishSQL.LocalClient" description="Provider with inprocess database Server" type="Borland.Data.DataStore.DataStoreProviderFactory, Borland.Data.BlackfishSQL.LocalClient, Version=8.0.0.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"/>
          <add name="BlackfishSQL Remote Provider" invariant="Borland.Data.BlackfishSQL.RemoteClient" description="Provider for connectivity to BlackfishSQL Server" type="Borland.Data.DataStore.DataStoreProviderFactory, Borland.Data.BlackfishSQL.RemoteClient, Version=8.0.0.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"/>
          <add name="AdoDbx Data Provider" invariant="Borland.Data.AdoDbxClient" description=".Net Framework Data Provider for dbExpress Drivers" type="Borland.Data.TAdoDbxProviderFactory, Borland.Data.AdoDbxClient, Version=11.0.5000.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"/>
      </DbProviderFactories>
    </system.data>
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 9:14:17
18楼: 再提一嘴,Excel 2003 格式的 .xls 导入是正常的,就是 2007以上的格式不行
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 9:16:46
19楼: 唉,要是实在搞不定,只好趁国庆放假,重装系统了,没有什么不是重装系统搞不定的,如果不行,那就再装一次按此在新窗口浏览图片
----------------------------------------------
-
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 11:26:43
20楼: 还发现一个问题,虽然我ACE12,ACE16都安装了,在SQL SERVER里也能看到,如上面帖子截图。
但在TADOConnection的Provider里找不到ACE。
此帖子包含附件:
PNG 图像
大小:9.9K
----------------------------------------------
-
作者:
男 c5soft (大道至简) ▲▲▲▲▲ -
普通会员
2020/9/29 13:46:41
21楼: 哪有那么麻烦,能远程吗,我帮你搞,把联系方式发我邮箱c5soft@189.cn
----------------------------------------------
-
作者:
男 grjs_2004 (grjsITname) ★☆☆☆☆ -
盒子活跃会员
2020/9/29 14:57:30
22楼: Excel文件,必须在数据库安装的服务器上!数据导入Excel或其他文件,是默认本机的文件路径的!
----------------------------------------------
Everyone will to do best!
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2020/9/29 19:59:34
23楼: @c5soft (大道至简)
谢谢你的热心,不过有问题的工作机在公司,有防火墙限制,无法远程。
看你最上面回复了2次,是自己程序里操作Excel文件,这个我用ADO来做了,没用第三方控件,事实上我一直尽量避免用第三方控件。

我现在遇到的问题,其实是在 SQL SERVER 服务器上,用微软亲生的 Microsoft SQL Server Management Studio 来把 Excel 文件里的数据导入数据库,一切操作,都在SQL SERVER 服务器上。

@grjs_2004 (grjsITname)
是的,Excel文件在SQL SERVER 服务器本机上操作的。
ACE 装了卸,卸了装,反反复复折腾好几次了,如果说是ACE注册问题,重装也不能修复吗?只差重装系统了。
----------------------------------------------
-
作者:
男 c5soft (大道至简) ▲▲▲▲▲ -
普通会员
2020/9/30 9:27:37
24楼: 用Delphi7与10.4.1的TAdoConnection试了一下,在Oledb数据源中是看不到ACE的。

我把以往的经验总结了一下,写了两个存储过程,一个建立连接,一个断开连接。在SQL Server 2012测试通过。

用sa登录,打开查询分析器,选择工作数据库,运行完我写的SQL程序,以后直接使用spExcelAddLink/spExcelDropLink就万事大吉了。

我喜欢用随SQL Server 2000发布的查询分析器的绿色版,这是微软最后的Native Code, 从2005开始就是Management Studio了,基于DotNet的,速度太慢,用起来不爽,除非Profiler,那是没办法。SQL 2K绿色版用来连接SQL Server 2019都是没问题的。所有的操作都是通过SQL命令搞定,包括数据备份与恢复。
此帖子包含附件:c5soft_202093092737.zip 大小:1,329B
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行234.375毫秒 RSS