下面是修改BDE的一个例子
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DBTables;
type
TForm1 = class(TForm)
Button1: TButton;
Session1: TSession;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
bdecslist:TStringList;
bdename,bdepath,bdesjkbm:String;
begin
bdename:='BDE-DBASE';
bdepath:=ExtractFilePath(application.ExeName)+'data';
bdesjkbm:='qwert';
Session1.SessionName:='abcde';
bdecslist:=TStringList.Create;
bdecslist.Add('LEVER=5');
bdecslist.Add('MDX BLOCK SIZE=1024');
bdecslist.Add('MEMO FILE BLOCK SIZE=1024');
Session1.ModifyDriver('DBASE',bdecslist);
if Session1.IsAlias(bdename) then Session1.DeleteAlias(bdename);
bdecslist.Clear;
bdecslist.Add('DEFAULT DRIVER=DBASE');
bdecslist.Add('ENABLE BCD=FALSE');
bdecslist.Add('PATH='+bdepath);
Session1.AddAlias(bdename,'standard',bdecslist);
Session1.SaveConfigFile;
bdecslist.Free;
end;
end.