Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database support for ms access
#1
Any chance QM will support the latest ms access databases (2007, 2010) anytime soon? These databases have file extension ACCDB (not MDB).

Thanks for letting me know.
#2
Need different connection string. This version supports it. Will be updated in QM 2.3.4.
You can replace your Database.CsAccess with this code now. If don't know how to do it, create new member function Database.CsAccess2, paste this code, and in macros use CsAccess2 instead of CsAccess.
Thank you.

Member function Database.CsAccess
Code:
Copy      Help
function'str $dbFile [providerFlags] [$dbPassword] [$systemDb] [$moreParams] ;;providerFlags: 0 ODBC driver, 1 Jet/ACE, 2 Office 2007+ format

;Creates connection string for MS Access.

;dbFile - Access database file (.mdb, .accdb).
;providerFlags - what provider to use:
;;;0 (default) - Microsoft Access ODBC Driver.
;;;1 - Microsoft Jet OLE DB 4.0 or ACE OLEDB 12.0, depending on file format.
;;;2 (QM 2.3.4) - Office 2007+ file format. This flag is optional if dbFile ends with ".accdb".
;dbPassword - database password. Can be encrypted (Options -> Security) for function Database.Open.
;systemDb - mdw file (if using a workgroup). Pass user id and password to the Open function.
;moreParams - will be appended to the connection string.

;REMARKS
;QM 2.3.4. Supports Office 2007+ file format (.accdb). If dbFile ends with ".accdb" or used flag 2, creates connection string for .accdb. If flag 1, uses ACE OLEDB 12.0, else accdb driver. Requires Office 2007 or later.
;Else creates connection string for older file format (.mdb). If flag 1, uses Jet OLE DB 4.0, else driver.


lpstr f1 f2 f3
int accdb=providerFlags&2 or matchw(dbFile "*.accdb" 1)

if providerFlags&1
,if(accdb) f1="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=%s;Persist Security Info=False;"
,else f1="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;"
,f2="Jet OLEDB:System Database=%s;"
,f3="Jet OLEDB:Database Password=%s;"
else
,if(accdb) f1="Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=%s;"
,else f1="Driver={Microsoft Access Driver (*.mdb)};Dbq=%s;"
,f2="SystemDB=%s;"
,f3="pwd=%s;"

str s.format(f1 _s.expandpath(dbFile))
if(len(systemDb)) s.formata(f2 _s.expandpath(systemDb))
if(len(dbPassword)) s.formata(f3 dbPassword)
s+moreParams

ret s
#3
Works like a charm!
Don't have to wait for the next release. Good job!
Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)