Page 1 of 1
DB exists but will not open [Exquisitely SOLVED]
Posted: Wed Apr 25, 2007 10:16 pm
by Rook Zimbabwe
I have tried to open a ACCESS DB with this...
Code: Select all
ODBCDatabaseName$ = "wunder1.mdb"
yes1 = InitDatabase()
Debug yes1
yes2 = OpenDatabase(#DB, ODBCDatabaseName$, "", "")
Debug yes2
The MBD file and the program are saved in the same directory. Filename is verified.
yes1 = 13069??? so it works
yes2 = 0 and the program hangs...
There is no username or PW
I am stumped
Posted: Wed Apr 25, 2007 10:20 pm
by srod
Have you registered the database connection through the ODBC control panel? If not, then this would explain your problem.

Posted: Wed Apr 25, 2007 10:29 pm
by netmaestro
Code: Select all
Declare AddConnection(Driver.s,ConnectString.s)
Declare RemoveConnection(Driver.s,DSN.s)
#ODBC_ADD_DSN = 1
#ODBC_CONFIG_DSN = 2
#ODBC_REMOVE_DSN = 3
;Replace File$ with a database that exists on your system!
File$ = "d:\wordconnect\twl98.mdb"
Result=AddConnection("Microsoft Access Driver (*.mdb)","Server=127.0.0.1; Description=MyDescription ;DSN=MyDSN;DBQ="+File$+";UID=;PWD=;")
If Result
InitDatabase()
db = OpenDatabase(0, "MyDSN", "", "")
If db
Debug "Opened Successfully"
CloseDatabase(0)
If RemoveConnection("Microsoft Access Driver (*.mdb)","MyDSN")
Debug "Closed Successfully"
EndIf
EndIf
EndIf
Procedure AddConnection(Driver.s,ConnectString.s)
Result=SQLConfigDataSource_(0,#ODBC_ADD_DSN,Driver,ConnectString )
If Result
ProcedureReturn 1
EndIf
EndProcedure
Procedure RemoveConnection(Driver.s,DSN.s)
Result=SQLConfigDataSource_(0,#ODBC_REMOVE_DSN,Driver,"DSN="+DSN)
If Result
ProcedureReturn 1
EndIf
EndProcedure
Posted: Wed Apr 25, 2007 11:02 pm
by Rook Zimbabwe
NetMaestro... You and Srod and Trond and a great many others are REALLY doing more than a fair share of the helping out around here. I hope I can be as helpful to twinkiebrains like me one day!!!!!!!

Posted: Fri Jun 15, 2007 6:30 pm
by GeoTrail
Thanks for that netmaestro.
Very helpfull
