I'm writing an application that reads and writes on a database using ODBC 3 and the Access Driver.
How can I compact this database ? I think I should use DAO but i don't know what it is.
How can I compact this database ? I think I should use DAO but i don't know what it is.
For ODBC. (ODBC Drivers Help)
Using SQLConfigDataSource
To perform data compaction on a database file programmatically, include "COMPACT_DB=<path_name><optional_sort_order><optional ENCRYPT keyword>" in the list of attributes (lpszAttributes) of the SQLConfigDataSource function. In this function, <path_name> is the full path to the Microsoft Access database to be compacted.
When compacting a password-protected file, a password and user id must be entered in the advanced options dialog box (or in the list of attributes for SQLConfigDataSource, if compacting programmatically). The password and user id should be removed after the compaction. Compacting password-protected files may have unpredicted results.
Using SQLConfigDriver
To perform data compaction on a database file programmatically using SQLConfigDriver, include "COMPACT_DB=<path_name><optionaL_sort_order><optional ENCRYPT keyword>" in the list of arguments (lpszArgs) of the SQLConfigDriver function. In this function, <path_name> is the full path to the Microsoft Access database to be compacted.
Using SQLConfigDataSource
To perform data compaction on a database file programmatically, include "COMPACT_DB=<path_name><optional_sort_order><optional ENCRYPT keyword>" in the list of attributes (lpszAttributes) of the SQLConfigDataSource function. In this function, <path_name> is the full path to the Microsoft Access database to be compacted.
When compacting a password-protected file, a password and user id must be entered in the advanced options dialog box (or in the list of attributes for SQLConfigDataSource, if compacting programmatically). The password and user id should be removed after the compaction. Compacting password-protected files may have unpredicted results.
Using SQLConfigDriver
To perform data compaction on a database file programmatically using SQLConfigDriver, include "COMPACT_DB=<path_name><optionaL_sort_order><optional ENCRYPT keyword>" in the list of arguments (lpszArgs) of the SQLConfigDriver function. In this function, <path_name> is the full path to the Microsoft Access database to be compacted.
It doesn't work. Maybe I have done a mistake
I used this code. It returned false and SQLInstallerError returned ODBC_ERROR_REQUEST_FAILED.
Can you help me ???. You can download the code from http://greenant.cjb.net -->> gremaf
.data
driverr db "Microsoft Access Driver (*.mdb)",0
attri db "COMPACT_DB=C:\masm32\bin\gremaf\gamelist.mdb",0,0
.code
invoke SQLConfigDataSource, hWnd, ODBC_CONFIG_DSN, addr driverr, addr attri
I used this code. It returned false and SQLInstallerError returned ODBC_ERROR_REQUEST_FAILED.
Can you help me ???. You can download the code from http://greenant.cjb.net -->> gremaf
.data
driverr db "Microsoft Access Driver (*.mdb)",0
attri db "COMPACT_DB=C:\masm32\bin\gremaf\gamelist.mdb",0,0
.code
invoke SQLConfigDataSource, hWnd, ODBC_CONFIG_DSN, addr driverr, addr attri
greenant,
try using
attri db "COMPACT_DB=C:\masm32\bin\gremaf\gamelist.mdb C:\masm32\bin\gremaf\gamelist.mdb General",0,0
The first C:\masm32\bin\gremaf\gamelist.mdb is the source.
The second is the destination.
If you feel brave you can compact to the same name, otherwise you will have to set a different destination and do delete on source and rename on destination. Hope that made sense.
I have not tried this yet in assembler. I will try it when I have some time. I getting the link error as you.
The help file snippet I posted above really leaves a lot out.
try using
attri db "COMPACT_DB=C:\masm32\bin\gremaf\gamelist.mdb C:\masm32\bin\gremaf\gamelist.mdb General",0,0
The first C:\masm32\bin\gremaf\gamelist.mdb is the source.
The second is the destination.
If you feel brave you can compact to the same name, otherwise you will have to set a different destination and do delete on source and rename on destination. Hope that made sense.
I have not tried this yet in assembler. I will try it when I have some time. I getting the link error as you.
The help file snippet I posted above really leaves a lot out.
good news and bad news.
good news - the above form for attributes does work.
bad news - had to includelib MSVCRT.LIB to get it to link.
good news - the above form for attributes does work.
bad news - had to includelib MSVCRT.LIB to get it to link.