Creating a NEW ODBC Database:
In my tests I have supplied a blank database with a FileDSN for the LoadDatabase call.
I can add/delete tables/records.
What i can't seem to do is CREATE the blank file from within Blitz. The only function i can see is LoadDatabase.
The below code has me confused:
SuperStrict
Import bah.dbodbc
Global db:TDBConnection
db = LoadDatabase("ODBC", "C2D.mdb", Null, Null, Null, Null, "c:\C2D.mdb")
' Check that the DB connection has been made
If Not db Then
Notify("Unable to Open the Database c:\C2D.mdb")
End
Else
DebugLog ("Opened")
End If
' Check if the database has an error on opening
If db.hasError() Then
errorAndClose(db)
End If
Function errorAndClose(db:TDBConnection)
DebugLog(db.error().toString())
db.close()
Notify("Read the DebugLog to see what the error was")
End
End Function
The debuglog tells me db has opened but i suppose that is because db exists, even if it is null. then the errorandclose function kicks in.
No file is created.
I have read the source files and found references for SQLWriteFileDSN.c but i don't have the faintest clue how to invoke it.
also i was hoping the LoadDatabase call would act like an OpenStream call whereby the file is created if it doesn't exist. obviously it doesn't. I couldn't locate any other command like "CreateDatabase".
How do you guys create a database file and a file DSN for ODBC types?
Cheers
Glenn