.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.90
Released: May 18, 2017
Price: $ 149

downloadorder


Our Customers



Testimonials

The other people in the office didn't believe me when I said that all I had to do was document the problem and you would probably give me a fix overnight. Unbelievable! Keep up the great work. I hope you guys all make a fortune out of this product because it is truly fantastic and the support is the best I have ever encountered.

Mark Kefford

        © 2003 - 2017 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Dec 11, 2017