我来拿分:
1、操作Access用DiamondAccess,不需要驱动
压缩test.mdb使用
__DBEngine36.CompactDatabase ('test.mdb','temp.tmp', '', 0, '');//将test.mdb压缩为test.tmp
DeleteFile('test.mdb');//删除原文件
RenameFile('test.tmp','test.mdb');//将压缩好的test.tmp改名为test.mdb
2、操作*.db做个最简化BDE(没找到脱离BDE操作*.db的控件)
需要的BDE文件:Idapi32.dll,Blw32.dll,Idr20009.dll,Fareast.bll,Usa.bll,Idpdx32.dll,
,bantam.dll,fareast.btl,charset.cvb共9个文件,一个不能缺。
将这些文件注册并将BDE的一些注册信息写入注册表。
下面是本人做的BDE安装程序(程序用D5做好,用ASPACK压缩后大小为711K,D6做文件要大一些):
将这9个文件做成资源文件DBDRV1.RES。
源代码为:
program DBDrv;
uses
Forms,Windows,Classes,
Registry,
FileCtrl;
{$R *.RES}
{$R DBDRV1.RES}
var
MyReg:TRegistry;
DBDrvRes:Tresourcestream;
begin
Application.Initialize;
MyReg:=TRegistry.Create;
MyReg.RootKey:=HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/Borland/Database Engine/', False) then
begin
MyReg.CloseKey;
MyReg.Free;
application.MessageBox('驱动已安装过!','系统信息',MB_Ok+MB_ICONWARNING);
Application.Terminate;
end
else
begin
MyReg.CloseKey;
MyReg.Free;
MyReg:=TRegistry.Create;
MyReg.RootKey:=HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/Borland/Database Engine/', True) then
begin
MyReg.WriteString('DLLPATH','C:/Program Files/Common Files/Borland Shared/BDE');
end;
MyReg.CloseKey;
MyReg.Free;
MyReg:=TRegistry.Create;
MyReg.RootKey:=HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/Borland/BLW32', True) then
begin
MyReg.WriteString('BLAPIPATH','C:/Program Files/Common Files/Borland Shared/BDE');
MyReg.WriteString('LOCALE_LIB1','C:/Program Files/Common Files/Borland Shared/BDE/USA.BLL');
MyReg.WriteString('LOCALE_LIB2','C:/Program Files/Common Files/Borland Shared/BDE/FAREAST.BLL');
end;
MyReg.CloseKey;
MyReg.Free;
MyReg:=TRegistry.Create;
MyReg.RootKey:=HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/Borland/BLW32', True) then
begin
MyReg.WriteString('BLAPIPATH','C:/Program Files/Common Files/Borland Shared/BDE');
MyReg.WriteString('LOCALE_LIB1','C:/Program Files/Common Files/Borland Shared/BDE/USA.BLL');
MyReg.WriteString('LOCALE_LIB2','C:/Program Files/Common Files/Borland Shared/BDE/FAREAST.BLL');
end;
MyReg.CloseKey;
MyReg.Free;
MyReg:=TRegistry.Create;
MyReg.RootKey:=HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/Borland/Database Engine/Settings/DRIVERS/PARADOX/INIT', True) then
begin
MyReg.WriteString('VERSION','4.0');
MyReg.WriteString('TYPE','FILE');
MyReg.WriteString('LANGDRIVER','china');
end;
MyReg.CloseKey;
MyReg.Free;
MyReg:=TRegistry.Create;
MyReg.RootKey:=HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/Borland/Database Engine/Settings/DRIVERS/PARADOX/TABLE CREATE', True) then
begin
MyReg.WriteString('LEVEL','7');
MyReg.WriteString('BLOCK SIZE','2048');
MyReg.WriteString('FILL FACTOR','95');
MyReg.WriteString('STRICTINTEGRTY','TRUE');
end;
MyReg.CloseKey;
MyReg.Free;
ForceDirectories('C:/Program Files/Common Files/Borland Shared/BDE');
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D1');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/Idapi32.dll');
DBDrvRes.Free;
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D2');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/Blw32.dll');
DBDrvRes.Free;
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D3');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/Idr20009.dll');
DBDrvRes.Free;
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D4');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/Fareast.bll');
DBDrvRes.Free;
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D5');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/Usa.bll');
DBDrvRes.Free;
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D6');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/Idpdx32.dll');
DBDrvRes.Free;
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D7');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/bantam.dll');
DBDrvRes.Free;
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D8');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/fareast.btl');
DBDrvRes.Free;
DBDrvRes:=Tresourcestream.Create(HInstance,'DBDRV','D9');
DBDrvRes.SaveToFile('C:/Program Files/Common Files/Borland Shared/BDE/charset.cvb');
DBDrvRes.Free;
application.MessageBox('驱动安装完成!','系统信息',MB_Ok+MB_ICONWARNING);
Application.Terminate;
end;
end.