home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap07 / howto05 / inmemory / memform.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-09-15  |  953 b   |  54 lines

  1. unit Memform;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, DB, DBTables, ExtCtrls, DBCtrls, Grids, DBGrids,
  8.   MemTable;
  9.  
  10. type
  11.   TForm1 = class(TForm)
  12.     DataSource1: TDataSource;
  13.     DBGrid1: TDBGrid;
  14.     DBNavigator1: TDBNavigator;
  15.     procedure FormCreate(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.     InMemoryTable : TInMemoryTable;
  19.   public
  20.     { Public declarations }
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. procedure TForm1.FormCreate(Sender: TObject);
  31. var
  32.   ATable: TTable;
  33. begin
  34.   ATable := TTable.Create( Self );
  35.   ATable.DatabaseName := 'DBDEMOS';
  36.   ATable.TableName := 'CUSTOMER.DB';
  37.   ATable.Open;
  38.  
  39.   InMemoryTable := TInMemoryTable.CreateLike(
  40.     ATable,
  41.     'MyInMem',
  42.     Self
  43.   );
  44.  
  45.   DataSource1.DataSet := InMemoryTable;
  46.   InMemoryTable.Open;
  47.  
  48.   ATable.Close;
  49.   ATable.Free;
  50.  
  51. end;
  52.  
  53. end.
  54.