Office中國(guó)論壇/Access中國(guó)論壇

 找回密碼
 注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

返回列表 發(fā)新帖
查看: 8708|回復(fù): 5
打印 上一主題 下一主題

[ADO/DAO] VB或Access如何使用Sqlite數(shù)據(jù)庫(kù)的心得集錦

[復(fù)制鏈接]

點(diǎn)擊這里給我發(fā)消息

跳轉(zhuǎn)到指定樓層
1#
發(fā)表于 2015-5-17 10:32:43 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
最近因客戶(hù)需要,要用到Sqlite數(shù)據(jù)庫(kù),前端工具使用VB或Access, 在使用過(guò)程中遇到一些問(wèn)題,(特別感謝 席主習(xí)_smileyoufu 幫助)通過(guò)網(wǎng)友幫助和網(wǎng)上搜索,將一些解決心得寫(xiě)下來(lái),希望對(duì)Sqlite入門(mén)者有所幫助和啟動(dòng)
1.VB或Access 要直接使用Sqlite數(shù)據(jù)庫(kù),需要安裝一個(gè)Sqlite litex的版本,才能正常注冊(cè)sqlite3.dll
    但實(shí)際我在注冊(cè)中,在一些電腦注冊(cè)會(huì)出現(xiàn)使用問(wèn)題,網(wǎng)友如果測(cè)試成功,請(qǐng)跟貼
    sqlite lites使用說(shuō)明及下載地址: http://blog.sina.com.cn/s/blog_48e2ea3401018fiz.html
2.可使用 sqliteforexcel 解決方案,里面封裝了一個(gè)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.)

      缺點(diǎn):是沒(méi)有創(chuàng)建新數(shù)據(jù)庫(kù)的方法,使用接口 與ado 不太兼容,語(yǔ)法不相同。遷移成本有點(diǎn)高

3. 第三種解決方案,也是   席主習(xí)_smileyoufu 提供方案,使用vbRichClient5.dll    vb_cairo_sqlite.dll   DirectCOM.dll
     可實(shí)現(xiàn)免注冊(cè)使用sqlite數(shù)據(jù)庫(kù),且因?yàn)?vbRichClient5 的封裝,使用Sqlite數(shù)據(jù)庫(kù)幾乎 沒(méi)有太大的差異。
     且Sqlite的數(shù)據(jù)庫(kù)在一些性能性,特別的內(nèi)存數(shù)據(jù)庫(kù),速度非常的快。對(duì)一些單機(jī)軟件非常適合
     使用方法,從 http://www.vbrichclient.com/ 官方下載
     vbRichClient5.dll    vb_cairo_sqlite.dll   DirectCOM.dll
     即可
     唯一缺點(diǎn)是發(fā)布時(shí)需要帶著  vbRichClient5.dll 庫(kù)(注冊(cè)或免注冊(cè)方式)
     vb_cairo_sqlite.dll (原生DLL,不需要注冊(cè))   DirectCOM.dll
     且 vb_cairo_sqlite.dll   vbRichClient5.dll 必須保持在同一個(gè)目錄即可

相關(guān)鏈接:
Access數(shù)據(jù)庫(kù)與Sqlite數(shù)據(jù)庫(kù)性能對(duì)比測(cè)試
http://m.mzhfr.cn/thread-119912-1-1.html

評(píng)分

參與人數(shù) 1經(jīng)驗(yàn) +1 收起 理由
風(fēng)中漫步 + 1 好貼

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享分享 分享淘帖 訂閱訂閱

點(diǎn)擊這里給我發(fā)消息

2#
發(fā)表于 2015-5-18 04:35:58 來(lái)自手機(jī) | 只看該作者
謝謝分享
回復(fù)

使用道具 舉報(bào)

3#
發(fā)表于 2015-5-18 11:48:22 | 只看該作者
王站,什么時(shí)候轉(zhuǎn)向了?{:soso_e114:}

VB6使用SQLite的選項(xiàng)不多,而且或多或少有這樣那樣的問(wèn)題。

1、litexSQlite,這是早期的比較牛的sqlite的com封裝。它牛到很多人想試圖修改它的源碼,但沒(méi)有一個(gè)能成功的?梢(jiàn)作者的c++功力是非常深厚的。
2、VBA版本的,確實(shí)讓人怎么用,怎么不習(xí)慣。這里面一個(gè)重要的原因是:大多數(shù)使用vba的人,如果不使用recordset,都不知道怎么使用數(shù)據(jù)庫(kù)里的數(shù)據(jù)?梢哉f(shuō)recordset快等同于數(shù)據(jù)庫(kù)了。
3、sqlite有oledb的驅(qū)動(dòng)程序,這不是官方的,但它有一個(gè)糟糕的問(wèn)題,必須注冊(cè),雖然它是免費(fèi)使用,但使用者必須注冊(cè)。這一點(diǎn)太糟糕了,糟糕到好象蛋蛋被人捏著一樣的疼。
4、vbrichclient5。它的使用是沒(méi)有問(wèn)題,問(wèn)題在于如果你只用sqlite的話(huà),那它的庫(kù)顯得有點(diǎn)龐大了一點(diǎn),因?yàn)槟悴挥盟钠渌δ,所以這樣的庫(kù),就是一個(gè)胖客戶(hù)端。我也是建議大家使用vbrichclient5。
5、其實(shí)我很早就知道vbrichclient的作者,那時(shí)候,他根本就還沒(méi)寫(xiě)vbrichclient。那時(shí),我也不知道他居然有這么大的雄心,會(huì)搞成這么大的框架。我在這里猶豫著要不要說(shuō),其實(shí)不用vbrichclient5,還可以使用更加小巧的適用vb使用的SQlite?偣膊500多K,而不是現(xiàn)在的5、6M這么大。只不過(guò)因?yàn)樗巡辉俦痪S護(hù)了,而且不是開(kāi)源的,即使有問(wèn)題,你也無(wú)從解決起。
如果我才這么猶豫著。




點(diǎn)擊這里給我發(fā)消息

4#
 樓主| 發(fā)表于 2015-5-18 11:53:01 | 只看該作者
冬瓜湯,原來(lái)你對(duì)Sqlite也有研究啊。
那個(gè)500K  的是什么DLL,使用方式是否像cRecordset一樣方便?
我現(xiàn)在是使用vbRichClient5.dll 使用還是比較方便,就是有點(diǎn)大,且免注冊(cè)方式在有些客戶(hù)電腦出關(guān)閉程序時(shí)出錯(cuò)。
我主要是解決一個(gè)客戶(hù)的問(wèn)題。他要求用這個(gè)。一般開(kāi)發(fā),我還是傾向于Access
5#
發(fā)表于 2015-5-18 13:20:54 | 只看該作者
本帖最后由 風(fēng)中漫步 于 2015-5-18 13:23 編輯

{:soso_e121:}不好意思啊,站長(zhǎng).能說(shuō)說(shuō)您開(kāi)發(fā)的這個(gè)庫(kù)用在哪方面嗎?昨天沒(méi)好意思問(wèn),如果不方便就別回了.

點(diǎn)擊這里給我發(fā)消息

6#
 樓主| 發(fā)表于 2015-5-18 13:30:17 | 只看該作者
1. 如果數(shù)據(jù)庫(kù)沒(méi)有修改,數(shù)據(jù)庫(kù)文件的日期不能改變
2. 大量需要不斷頻繁讀取服務(wù)器數(shù)據(jù)庫(kù)但數(shù)據(jù)并沒(méi)有經(jīng)常更新的場(chǎng)景,如單據(jù)中選擇產(chǎn)品資料,展示BOM等
3. 其它對(duì)數(shù)據(jù)速度有較高要求的
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則

QQ|站長(zhǎng)郵箱|小黑屋|手機(jī)版|Office中國(guó)/Access中國(guó) ( 粵ICP備10043721號(hào)-1 )  

GMT+8, 2025-7-13 20:37 , Processed in 0.102195 second(s), 34 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回復(fù) 返回頂部 返回列表