.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 > In Memory Table Delphi Example

Absolute Database

Overview | Features | Requirements | Testimonials | SQL Samples | Code Samples | Screenshots | See Also | Download | Order
In Memory Table Delphi Example
Shows how to use in-memory tables. It is very useful for speed-critical application.

Download Absolute Database | Learn more

unit Unit1;

interface
{$I CompVer.inc}

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

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

type
  TForm1 = class(TForm)
    mSQL: TMemo;
    btnCreateAndOpen: TButton;
    dbDemos: TABSDatabase;
    Query: TABSQuery;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    DBNavigator1: TDBNavigator;
    Label1: TLabel;
    btnSave: TButton;
    btnLoad: TButton;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    GroupBox1: TGroupBox;
    Label5: TLabel;
    tFriends: TABSTable;
    tFriendsInMemory: TABSTable;
    procedure FormCreate(Sender: TObject);
    procedure btnCreateAndOpenClick(Sender: TObject);
    procedure btnSaveClick(Sender: TObject);
    procedure btnLoadClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure EnableDisableControls;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.EnableDisableControls;
begin
  btnSave.Enabled := tFriendsInMemory.Exists;
  btnLoad.Enabled := tFriends.Exists;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  dbDemos.DatabaseFileName := ExtractFilePath(Application.ExeName) + DataBaseFileName;
  dbDemos.Open;
  EnableDisableControls;
end;

procedure TForm1.btnCreateAndOpenClick(Sender: TObject);
begin
  Query.Close;
  Query.SQL.Text := mSQL.Text;
  Query.Open;
  EnableDisableControls;
end;

procedure TForm1.btnSaveClick(Sender: TObject);
begin
  if tFriends.Exists then
    tFriends.DeleteTable;
  tFriendsInMemory.CopyTable(tFriends.TableName, dbDemos.DatabaseFileName);
  EnableDisableControls;
end;

procedure TForm1.btnLoadClick(Sender: TObject);
begin
  Query.Close;
  if tFriendsInMemory.Exists then
    tFriendsInMemory.DeleteTable;
  tFriends.CopyTable(tFriendsInMemory.TableName, 'MEMORY');
  mSQL.Text := 'select * from friends';
  btnCreateAndOpenClick(Sender);
  btnCreateAndOpen.Enabled := False;
end;

end.



In Memory Table Delphi Example
Download Absolute Database | Learn more


Product Info


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

downloadorder


Our Customers



Testimonials

Thanks again for the superb tech support, I was worried I'd hit a brick wall this close to the finish line. Even working on the weekend... you guys rock!!!

Bob Boyd

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Mar 19, 2024