The following piece of code will just create a brand new empty MSACCESS database in the script path.
I would go with MSACCESS because you should be able to find ODBC drivers on every Windows computers.
Thanks to the fact that we are using José Roca ODBC wrapper library, and and thanks to the fact that José library is compliant with ODBC 3.5, you can get info on Internet everywhere they are talking about ODBC.
I'm at work now but I will reply later on how to add tables and fields.
[code=thinbasic]
'----------------------------------------------------------------------------
'----------------------------------------------------------------------------
' This script will demonstrate how to:
'----------------------------------------------------------------------------
' Thanks to Jose Roca for his hard work on ODBC wrapper
'----------------------------------------------------------------------------
'---Use console module to show output
uses "console"
'---IMPORTANT: include this file in order to use ODBC functionalities
' inside your scripts
#include "%APP_INCLUDEPATH%\ODBC352.INC"
dim DBName as string
dim lRet as long
DBName = app_sourcepath & "new.mdb"
lRet = SQLConfigDataSource(0, %ODBC_ADD_DSN, "Microsoft Access Driver (*.mdb)", "CREATE_DB=" & DBName)
if lRet then
printl "Creation of " & DBName & " was OK."
else
printl "It was not possible to create " & DBName
end if
printl
printl "---Press a key to finish---"
waitkey
[/code]
Reference:
http://support.microsoft.com/kb/149558
Bookmarks