ciao,
io semplicemnte ho fatto in questo modo creando una procedura richiamabile da pulsante o tramite un evento:
Codice PHP:
procedure TForm1.open_database(SorgenteDati:string);
var Dir, Ext: string;
begin
with ADOConnection do
begin
SorgenteDati:= 'myDB2.mdb';
if not FileExists(SorgenteDati) then
begin
if Application.MessageBox('Database: ' + '',
'Errore grave', MB_ICONQUESTION + MB_YESNO) = IDYES then
begin
Application.Terminate();
end;
end;
Provider:='Microsoft.Jet.OLEDB.4.0';
ConnectionString:=
'Provider=Microsoft.Jet.OLEDB.4.0;' +
//'User ID=' +
//'Password="";' +
'Data Source='+ SorgenteDati + ';'+
'Mode=ReadWrite;' +
'Extended Properties="";' +
'Persist Security Info=True;' +
'Jet OLEDB:System database="";' +
'Jet OLEDB:Registry Path="";' +
'Jet OLEDB:Engine Type=5;' +
'Jet OLEDB:Database Locking Mode=1;' +
'Jet OLEDB:Global Partial Bulk Ops=2;' +
'Jet OLEDB:Global Bulk Transactions=1;' +
'Jet OLEDB:New Database Password="";' +
'Jet OLEDB:Create System Database=False;' +
'Jet OLEDB:Encrypt Database=False;' +
'Jet OLEDB:Don'#39't Copy Locale on Compact=False;' +
'Jet OLEDB:Compact Without Replica Repair=False;' +
'Jet OLEDB:SFP=False';
LoginPrompt := False;
Connected:=true;
mode:=cmReadWrite;
Open('','');
end;
ADOQuery.Active:=true;
end;
utilizzo una ADOConnection senza driver ODBC