|
最近因客户需要,要用到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
|
评分
-
查看全部评分
|