sub db_open()
Set cn = New ADODB.Connection cn.ConnectionString = "Provider = LCPI.IBProvider;data source=localhost:c:\test.fdb;ctype=win1251;user id=sysdba;password=masterkey;auto_commit=true" cn.Open Set rs = New ADODB.Recordset With rs .ActiveConnection = cn .CursorLocation = adUseClient .CursorType = adOpenDynamic .LockType = adLockOptimistic .Source = "select * from abc" .Open End With end sub 上述代碼但需要安裝 IBProvider_trial_32-64_3.0.0.7866_i.2.exe 之 OLE 驅(qū)動(dòng),注意選擇正確的版本是2.6.15.2931版應(yīng)用于ADO(而3.0 版是應(yīng)用于ADO.NET這里不做介紹) --------------------------------------------------------------------------------------------------- Dim conn As ADODB.Connection Dim rs As ADODB.Recordset Private Sub db_open() Set conn = New ADODB.Connection Set rs = New ADODB.Recordset conn.ConnectionString = "DRIVER=Firebird/InterBase(r) driver; UID=sysdba; PWD=masterkey;DBNAME=localhost:c:\test.fdb;" conn.Open With rs .ActiveConnection = conn .CursorLocation = adUseClient .CursorType = adOpenDynamic .LockType = adLockOptimistic .Source = "select * from abc" .Open End With end sub 以上代碼 必須安裝 Firebird_ODBC_2.0.0-Win32.exe 的 ODBC驅(qū)動(dòng). //********************************************************** 設(shè)計(jì)管理 FB 的工具本人推薦 ibexpert , 本站有最新版下載這里不做討論. 其他: VB 或 ACCESS 或 ASP 都可以很穩(wěn)定的操作 FB 數(shù)據(jù)庫, 當(dāng)然速度不如C++B 或 Delphi 快. 這是因?yàn)槎鄬臃庋b造成的速度損失,也與 ACCESS 或 ASP 的解釋型語言有關(guān)(VB編譯本地EXE除外,因?yàn)榫幾g成本地EXE實(shí)際上就是通過C2的編譯器完成的), 總體上本人實(shí)踐后的感覺良好... |
|