TabSheet: TTabSheet;
Label: TLabel;
Label: TLabel;
Label: TLabel;
Label: TLabel;
Label: TLabel;
ListBox: TListBox;
ListBox: TListBox;
ListBox: TListBox;
Edit: TEdit;
ComboBox: TComboBox;
BitBtn: TBitBtn;
TabSheet: TTabSheet;
Memo: TMemo;
procedure FormCreate(Sender: TObject)
procedure ListBoxClick(Sender: TObject)
procedure ListBoxClick(Sender: TObject)
procedure BitBtnClick(Sender: TObject)
end;
var
QueryForm: TQueryForm;
implementation
{$R *DFM}
uses RSLTFORM;
procedure TQueryFormFormCreate(Sender: TObject)
begin
ScreenCursor := crHourglass;
{ Populate the alias list }
with ListBox do
begin
ItemsClear;
SessionGetAliasNames(Items)
end;
{ Make sure there are aliases defined }
ScreenCursor := crDefault;
if ListBoxItemsCount < then
MessageDlg( There are no database aliases currently defined You
need at least one alias to use this demonstration
mtError [mbOK] )
{ Default the dropdown list to the first value in the list }
ComboBoxItemIndex := ;
end;
procedure TQueryFormListBoxClick(Sender: TObject)
var
strValue: string; { Holds the alias selected by the user }
bIsLocal: Boolean; { Indicates whether or not an alias is local }
slParams: TStringList; { Holds the parameters of the selected alias }
iCounter: Integer; { An integer counter variable for loops}
begin
{ Determine the alias name selected by the user }
with ListBox do
strValue := ItemsStrings[ItemIndex];
{ Get the names of the tables in the alias and put them in the
appropriate list box making sure the users choices are reflected
in the list }
ListBoxItemsClear;
SessionGetTableNames(strValue { alias to enumerate }
{ pattern to match }
CheckBoxChecked { show extensions flag }
CheckBoxChecked { show system tables flag }
ListBoxItems) { target for table list }
{ Make sure there are tables defined in the alias If not show an
error; otherwise clear the list box }
ScreenCursor := crDefault;
if ListBoxItemsCount < then
MessageDlg(There are no tables in the alias you selected Please
choose another mtError [mbOK] )
ListBoxItemsClear;
end;
procedure TQueryFormListBoxClick(Sender: TObject)
begin
ScreenCursor := crHourglass;
try
{ First disable the TTable object }
if TableActive then
TableClose;
{ Open the selected table }
with ListBox do
TableDatabaseName := ItemsStrings[ItemIndex];
with ListBox do
TableTableName := ItemsStrings[ItemIndex];
{ Open the table and put a list of the field names in the Fields
list box }
[] [] [] []