home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 48 / SENT14D.ISO / tech / delphi / disk15 / datalist.pak / MAIN.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1995-08-24  |  1.3 KB  |  56 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, 
  6.   StdCtrls, DBTables, DB;
  7.  
  8. type
  9.   TForm1 = class(TForm)
  10.     DatabaseListbox: TListBox;
  11.     TableListbox: TListBox;
  12.     FieldListbox: TListBox;
  13.     IndexListbox: TListBox;
  14.     Label1: TLabel;
  15.     Label2: TLabel;
  16.     Label3: TLabel;
  17.     Label4: TLabel;
  18.     Table: TTable;
  19.     procedure TableListboxClick(Sender: TObject);
  20.     procedure DatabaseListboxClick(Sender: TObject);
  21.     procedure FormCreate(Sender: TObject);
  22.   end;
  23.  
  24. var
  25.   Form1: TForm1;
  26.  
  27. implementation
  28.  
  29. {$R *.DFM}
  30.  
  31. procedure TForm1.TableListboxClick(Sender: TObject);
  32. begin
  33.   FieldListbox.Clear;
  34.   IndexListbox.Clear;
  35.   Table.DatabaseName := DatabaseListbox.Items[DatabaseListbox.ItemIndex];
  36.   Table.TableName := TableListbox.Items[TableListbox.ItemIndex];
  37.   Table.GetFieldNames(FieldListbox.Items);
  38.   Table.GetIndexNames(IndexListbox.Items);
  39. end;
  40.  
  41. procedure TForm1.DatabaseListboxClick(Sender: TObject);
  42. begin
  43.   TableListbox.Clear;
  44.   FieldListbox.Clear;
  45.   IndexListbox.Clear;
  46.   Session.GetTableNames(DatabaseListbox.Items[DatabaseListbox.ItemIndex],
  47.     '', True, False, TableListbox.Items);
  48. end;
  49.  
  50. procedure TForm1.FormCreate(Sender: TObject);
  51. begin
  52.   Session.GetDatabaseNames(DatabaseListbox.Items);
  53. end;
  54.  
  55. end.
  56.