-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Suresh[MS MVP]
Message 2 in Discussion
check this code found it on net const
ODBC_ADD_DSN = 1; // Add data source
ODBC_CONFIG_DSN = 2; // Configure (edit) data source
ODBC_REMOVE_DSN = 3; // Remove data source
ODBC_ADD_SYS_DSN = 4; // add a system DSN
ODBC_CONFIG_SYS_DSN = 5; // Configure a system DSN
ODBC_REMOVE_SYS_DSN = 6; // remove a system DSN
ODBC_REMOVE_DEFAULT_DSN = 7; // remove the default DSN
function SQLConfigDataSource(
hwndParent: HWND;
fRequest: WORD;
lpszDriver: LPCSTR;
lpszAttributes: LPCSTR): BOOL; stdcall; external 'ODBCCP32.DLL';
function AddDSN(const DSN, Database, Description: String): Boolean; begin
Result := SQLConfigDataSource(0, ODBC_ADD_DSN,
'Microsoft Access Driver (*.mdb)', PChar(
'DSN=' + DSN + #0 +
'Driver=ODBCJT32.DLL'#0 +
'DBQ=' + Database + ''#0 +
'DefaultDir=' + ExtractFilePath(Database) + #0 +
'Description=' + Description + #0 +
'FIL=MS Access'#0 +
'UID=Admin'#0));
end;
function RemoveDSN(const DSN: String): Boolean;
begin
Result := SQLConfigDataSource(0, ODBC_REMOVE_DSN,
'Microsoft Access Driver (*.mdb)', PChar(
'DSN=' + DSN + #0));
end;
function RepairDB(const Database: String): Boolean;
begin
Result := SQLConfigDataSource(0, ODBC_ADD_DSN,
'Microsoft Access Driver (*.mdb)', PChar(
'REPAIR_DB=' + Database + #0));
end;
function CompactDB(const Database1, Database2: String): Boolean; begin
Result := SQLConfigDataSource(0, ODBC_ADD_DSN,
'Microsoft Access Driver (*.mdb)', PChar(
'COMPACT_DB=' + Database1 + ' ' + Database2 + ' General'#0));
end;
Suresh [Microsoft MVP | MCAD.NET(CM) | MCSD.NET(CM)]
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]