PowerBuilder Connect MS-Access Database Using OLE DB
Step 1: Driver Microsoft.Jet.OLEDB.4.0 MS-Access Database. Normally, if you connect to the .mdb extension, the driver is available in the window (Microsoft Access Driver (* .mdb)). If you connect to the .accdb(Microsoft.ACE.OLEDB.12.0) extension from office 2007 or later, you can download it on the mirosoft home page: https://www.microsoft.com/en-us/download/details.aspx?id=13255
Step 2: Test Connect
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
String ls_db, ls_database, ls_user, ls_pass ls_user = "admin" ls_pass = "pass" ls_database = "database file .mdb or .accdb" Transaction ltran_conn ltran_conn = Create Transaction If upper(right(trim(ls_database), 4)) = ".MDB" Then ltran_conn.DBParm = "PROVIDER='Microsoft.Jet.OLEDB.4.0',DATASOURCE='"+ls_database+"" Else ltran_conn.DBParm = "PROVIDER='Microsoft.ACE.OLEDB.12.0',DATASOURCE='"+ls_database+"" End if // Using OLE DB Connect To MS Access ltran_conn.DBMS ="OLE DB" ltran_conn.AutoCommit = False ltran_conn.LogId = ls_user ltran_conn.LogPass = ls_pass Connect Using ltran_conn ; If ltran_conn.SQLCode = -1 Then MessageBox('Warning','Connect Database Error' + ltran_conn.SQLErrText) Else MessageBox('Warning',"Connect Success!") End If Disconnect Using ltran_conn ; |
Find Projects On Github click here
Good Luck!
Subscribe
Login
0 Comments