примерно так:
Код:
function ConnectDataBase:boolean;
//Присоединение базы данных
begin
Result:=False;
if not(FileExists(DataBasePath)) then
begin
ShowMessage('Data Base file not found');
Exit;
end;
try
with MainADOConnection do
begin
ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+DataBasePath+';Persist Security Info=False';
Connected:=True;
end;
except
on E:Exception do
begin
ShowMessage('Connect error');
Exit;
end;
end;
Result:=True;
end;
где
DataBasePath - полный путь с именем файла БД
MainADOConnection - TADOConnection