unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids, DB, ADODB;

type
  TForm1 = class(TForm)
    ADOConnection1: TADOConnection;
    ADOTable1: TADOTable;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    ListBox1: TListBox;
    procedure FormCreate(Sender: TObject);
    procedure ListBox1DblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
    ADOConnection1.GetTableNames(ListBox1.Items,false);
end;

procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
  with ADOTable1 do
  Begin
    if active then
        close;
    TableName:=ListBox1.Items.strings[ListBox1.ItemIndex];
    active:=true;
  end;
end;

end.
