Title: Opening a password protected access 97 file using ADO
Question: Opening a password protected access 97 file using ADO
Answer:
{ 
Open a TADOConnection to a password protected Access97 file specified by FileName. 
You must have the DSN "MS Access 97 Database". 
This will be the case if you have Access97 installed, otherwise 
you can make it in your ODBC settings. 
By E.J.Molendijk 
} 
procedure OpenADOConnection( 
 var MyCon : TADOConnection 
 FileName : String;
 User,Pass: String ); 
const 
 DBConnectPrefix = 
 'Provider=MSDASQL.1;'+ 
 'Persist Security Info=False;'+ 
 'Connect Timeout=15;'+ 
 'Extended Properties="'+ 
 'DSN=MS Access 97 Database;'+ 
 'DBQ='; 
var
 DBConnectionSuffix : String;
begin
 DBConnectionSuffix := ';'+
 'DriverId=281;'+
 'FIL=MS Access;'+
 'MaxBufferSize=2048;'+
 'PageTimeout=5;'+
 'UID='+User+';'+
 'PWD='+Pass+';'+
 '";'+
 'Locale Identifier=1043';
 MyCon.ConnectionString := DBConnectPrefix + Path + DBConnectionSuffix; 
 MyCon.Open; 
end;