.NET Zip component, Delphi Zip component, Barcode .NET, BDE Replacement and other .NET and Delphi components from ComponentAce
Products Download Order Contact us

Search
 

Delphi/C++ Components
.NET Components
ActiveX Controls
Kylix Components

Download

Download
Download Commercial
Trial Limitations

Support

Submit Request
Support Options

Order

Purchase
Competitive Upgrade
Premium Support
Sales Policy
Upgrade Policy
License Types

Info

News
Mailing List
Articles
Testimonials



About Us
Partners
Links
Contact Us
Link to Us





Home > Delphi/C++ Components > Absolute Database > Table List Delphi Example

Absolute Database

Overview | Features | Requirements | Testimonials | SQL Samples | Code Samples | Screenshots | See Also | Download | Order
Table List Delphi Example
Illustrates how to display list of all database tables.

Download Absolute Database | Learn more

unit uMain;

interface
{$I CompVer.inc}

uses
{$IFDEF D6H}
  Variants,
{$ENDIF}
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, DB, ABSMain, ComCtrls,
  StdCtrls;

const
  DataBaseFileName: String = '..\..\Data\Demos.abs';

type
  TForm1 = class(TForm)
    dbDemos: TABSDatabase;
    lvTables: TListView;
    ABSTable1: TABSTable;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    DBNavigator1: TDBNavigator;
    Label1: TLabel;
    lbSelectedTable: TLabel;
    Label2: TLabel;
    GroupBox1: TGroupBox;
    Label3: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure lvTablesChange(Sender: TObject; Item: TListItem;
      Change: TItemChange);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  tables: TStringList;
  i: integer;
begin
  dbDemos.DatabaseFileName := ExtractFilePath(Application.ExeName) + DataBaseFileName;
  dbDemos.Open;
  tables := TStringList.Create;
  try
    dbDemos.GetTablesList(tables);
    for i:=0 to tables.Count-1 do
      lvTables.Items.Add.Caption := tables[i];
  finally
    tables.free;
  end;
end;

procedure TForm1.lvTablesChange(Sender: TObject; Item: TListItem;
  Change: TItemChange);
begin
{$IFNDEF D5H}
  if (AnsiCompareText(Item.Caption, 'Dictionary') <> 0) then
    begin
{$ENDIF}
  if not (csDestroying in Form1.ComponentState) then
  begin
    lbSelectedTable.Caption := Item.Caption;
    ABSTable1.Close;
    ABSTable1.TableName := Item.Caption;
    ABSTable1.Open;
  end;
{$IFNDEF D5H}
    end;
{$ENDIF}
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  dbDemos.Close;
end;

end.



Table List Delphi Example
Download Absolute Database | Learn more


Product Info


Current version: 7.95
Released: February 08, 2023
Price: $ 149

downloadorder


Our Customers



Testimonials

I don't think I've ever had a better support experience in regard to any of the 3rd party tools we use.

Tim Stickley

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Oct 06, 2024