Use of SQLConfigDataSource ODBC installer DLL API function:
BOOL fCreated;
fCreated = SQLConfigDataSource(NULL,
ODBC_ADD_DSN,
"Microsoft Access Driver (*.mdb)",
"CREATE_DB=.\\ATest.mdb General\0" );
This will create ATest.mdb in the application's working directory using general sorting.
BOOL SQLConfigDataSource(hwndParent, fRequest, lpszDriver,
lpszAttributes)
Where:
hwndParent is either NULL if no dialogs are to be displayed or a valid hwnd to act as parent to any driver generated dialogs.
fRequest is ODBC_ADD_DSN to specify creation of the .mdb file.
lpszDriver is Microsoft Access Driver (*.mdb).
lpszAttributes is "CREATE_DB=<path><filename>.mdb <sort order>\0" where the <path><filename> combination identifies where the file should be created and <sort order> is language sorting order (for example, General). <path> must be specified even if the .mdb is to be created in the current working directory. Use standard relative path syntax.
NOTE: Unlike most other ODBC API functions, SQLConfigDataSource returns a boolean value. This return value is TRUE if the .mdb was created, FALSE if creation failed.