设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 7467|回复: 5
打印 上一主题 下一主题

[ADO/DAO] VB或Access如何使用Sqlite数据库的心得集锦

[复制链接]

点击这里给我发消息

跳转到指定楼层
1#
发表于 2015-5-17 10:32:43 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
最近因客户需要,要用到Sqlite数据库,前端工具使用VB或Access, 在使用过程中遇到一些问题,(特别感谢 席主习_smileyoufu 帮助)通过网友帮助和网上搜索,将一些解决心得写下来,希望对Sqlite入门者有所帮助和启动
1.VB或Access 要直接使用Sqlite数据库,需要安装一个Sqlite litex的版本,才能正常注册sqlite3.dll
    但实际我在注册中,在一些电脑注册会出现使用问题,网友如果测试成功,请跟贴
    sqlite lites使用说明及下载地址: http://blog.sina.com.cn/s/blog_48e2ea3401018fiz.html
2.可使用 sqliteforexcel 解决方案,里面封装了一个dll  ,下载地址: http://sqliteforexcel.codeplex.com/
    SQLite3_StdCall.dll
    SQLiteForExcel.xls  
    SQLiteForExcel_64.xlsm
    SQLiteForWord.doc
    里面也包含
  • SQLite3_StdCall is a small and very simple C .dll that makes it possible to use the standard SQLite3 .dll from VBA. It just passes calls from VBA on to SQLite without any change in the parameters, but this allows the StdCall calling convention that VB6 and VBA is limited to.
  • Sqlite3.bas VBA module has all the VBA Declares, and does the parameter and string conversions. It exposes a number of SQLite3xxxx functions. These map as directly as possible to the SQLite C API, with no change in the semantics. Although I have not exposed the whole API, most of the core interface is included, in particular the prepared statement, binding, retrieval and backup functions. Date values are stored as Julian day real numbers in the database.
  • Sqlite3Demo.bas VBA module has tests that serve as nice examples of how to use the SQLite3xxxx functions.
  • SQLite3Demo.xls contains the two VBA modules.
  • 64-bit support for use with the 64-bit versions of Excel can be found in SQLiteForExcel_64.xlsm which has VBA code that supports both 32-bit and 64-bit versions of Excel. A 64-bit build of SQLite 3.7.13 is located in x64\SQLite3.dll. The corresponding Sqlite3Demo_64.bas module shows how to target both 32-bit and 64-bit Excel with the same VBA code (some #Ifs are required). (Note that the default install of Office is always the 32-bit version, even on a 64-bit version of Windows. Only if the 64-bit version of Office has been specifically selected will the 64-bit modules be required.)

      缺点:是没有创建新数据库的方法,使用接口 与ado 不太兼容,语法不相同。迁移成本有点高

3. 第三种解决方案,也是   席主习_smileyoufu 提供方案,使用vbRichClient5.dll    vb_cairo_sqlite.dll   DirectCOM.dll
     可实现免注册使用sqlite数据库,且因为 vbRichClient5 的封装,使用Sqlite数据库几乎 没有太大的差异。
     且Sqlite的数据库在一些性能性,特别的内存数据库,速度非常的快。对一些单机软件非常适合
     使用方法,从 http://www.vbrichclient.com/ 官方下载
     vbRichClient5.dll    vb_cairo_sqlite.dll   DirectCOM.dll
     即可
     唯一缺点是发布时需要带着  vbRichClient5.dll 库(注册或免注册方式)
     vb_cairo_sqlite.dll (原生DLL,不需要注册)   DirectCOM.dll
     且 vb_cairo_sqlite.dll   vbRichClient5.dll 必须保持在同一个目录即可

相关链接:
Access数据库与Sqlite数据库性能对比测试
http://www.office-cn.net/thread-119912-1-1.html

评分

参与人数 1经验 +1 收起 理由
风中漫步 + 1 好贴

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享分享 分享淘帖 订阅订阅

点击这里给我发消息

2#
 楼主| 发表于 2015-5-18 11:53:01 | 显示全部楼层
冬瓜汤,原来你对Sqlite也有研究啊。
那个500K  的是什么DLL,使用方式是否像cRecordset一样方便?
我现在是使用vbRichClient5.dll 使用还是比较方便,就是有点大,且免注册方式在有些客户电脑出关闭程序时出错。
我主要是解决一个客户的问题。他要求用这个。一般开发,我还是倾向于Access

点击这里给我发消息

3#
 楼主| 发表于 2015-5-18 13:30:17 | 显示全部楼层
1. 如果数据库没有修改,数据库文件的日期不能改变
2. 大量需要不断频繁读取服务器数据库但数据并没有经常更新的场景,如单据中选择产品资料,展示BOM等
3. 其它对数据速度有较高要求的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-7 15:47 , Processed in 0.218753 second(s), 31 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表