var
rSysReg,registry1: TRegistry;
SysDir
Char;
AppPath,Params,Path,DbPath:string;
begin
AppPath:=ExtractFilePath(Application.ExeName); //取得应用程序的当前路径
GetMem(SysDir,255);
GetSystemDirectory(SysDir,255); //取得WINDOWS系统目录
Path:=String(SysDir);
registry1:=tregistry.Create;
registry1.RootKey:=HKEY_CURRENT_USER;
if registry1.OpenKey('software/odbc/odbc.ini/odbc data sources',true) then
begin
registry1.WriteString('MWKQ1','Microsoft Access Driver (*.mdb)');
registry1.CloseKey;
end;
if registry1.OpenKey('software/odbc/odbc.ini/MWKQ1',true) then
begin
registry1.WriteString('DBQ',apppath+'MWKQ1.mdb');
registry1.WriteString('Driver',path+'/odbcjt32.dll');
registry1.Writeinteger('DriverId',25);
registry1.writestring('FIL','MS Access;');
registry1.WriteInteger('SafeTransactions',0);
registry1.WriteString('UID','');
registry1.CloseKey;
end;
if registry1.OpenKey('software/odbc/odbc.ini/MWKQ1/Engines/Jet',true) then
begin
registry1.writestring('ImplicitCommitSync','Yes');
registry1.writeinteger('MaxBufferSize',512);
registry1.WriteInteger('PageTimeout',10);
registry1.writeinteger('Threads',3);
registry1.WriteString('UserCommitSync','Yes');
end;
registry1.CloseKey ;
registry1.Free;
end;
这个是联接ACCESS数据库时的ODBC的配置,你看看吧