第1个回答 2011-02-27
化数据库
if gConnLC<> nil then
begin
gConnLC.Free;
gConnLC:= nil;
end;
gConnLC:= TADOConnection.Create(nil);
gConnLC.KeepConnection:= True;
sPath:= ExtractFilePath(Application.ExeName) + 'db.mdb';
if FileExists(sPath) then
begin
//Access
with gConnLC do
begin
ConnectionString:= ' Provider=Microsoft.Jet.OLEDB.4.0;Data Source= ' + sPath + ';';
LoginPrompt:= False;
gConnLC.Open();
end;
end
else begin
MsgBox('本地数据库连接失败!', '提示', MB_OK + MB_ICONINFORMATION);
//Application.Terminate;
end;