Mainfrm.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:1k
- unit Mainfrm;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, DBTables;
- type
- TForm1 = class(TForm)
- BtnEnum: TButton;
- cmbAlias: TComboBox;
- lstTables: TListBox;
- Session: TSession;
- Label1: TLabel;
- procedure BtnEnumClick(Sender: TObject);
- procedure cmbAliasChange(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.BtnEnumClick(Sender: TObject);
- var
- bAlias: TStringList;
- begin
- bAlias := TStringList.Create; //创建一个字符串列表
- Session.GetAliasNames(bAlias);//利用TSession提供GetAliasNames方法获取系统所有BDE别名
- cmbAlias.Items.AddStrings(bAlias);//将bAlias字符串列表添加到cmbAlias下拉列表中
- bAlias.Clear;
- end;
- procedure TForm1.cmbAliasChange(Sender: TObject);
- var
- aTables: TStringList;
- begin
- aTables := TStringList.Create;
- try
- //利用TSession提供GetTalbeNames方法得到对应BDE别名的表
- Session.GetTableNames(cmbAlias.Text, '', false, false, aTables);
- lstTables.Items.Clear;
- lstTables.Items.AddStrings(aTables);
- finally
- aTables.Free;
- end;
- end;
- end.