var
strsource:string;
begin
adoconnection1.Close;
adoconnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=datafile;Persist Security Info=False';
try
adoconnection1.Open;
except
IF messagebox(0,'连接失败,手动连接?','错误',MB_YESNO+MB_ICONINFORMATION)=idyes then
begin
opendialog1.Filter:='*.mbb|*.mdb';
opendialog1.Execute;
strsource:=opendialog1.FileName;
adoconnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+strsource+';Persist Security Info=False';
end;
try
adoconnection1.Open;
except
// 错误处理
end;
end;