.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 > Batch Move Delphi Example

Absolute Database

Overview | Features | Requirements | Testimonials | SQL Samples | Code Samples | Screenshots | See Also | Download | Order
Batch Move Delphi Example
Shows how to move / update / synchronize records between two tables.

Download Absolute Database | Learn more

unit Main;

interface
{$I CompVer.inc}

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

type
  TForm1 = class(TForm)
    tSrc: TABSTable;
    tDst: TABSTable;
    DBGrid1: TDBGrid;
    DBGrid2: TDBGrid;
    Button1: TButton;
    Label2: TLabel;
    Label3: TLabel;
    Button2: TButton;
    dsSrc: TDataSource;
    dsDst: TDataSource;
    rgType: TRadioGroup;
    pb: TProgressBar;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure tDstBeforeBatchMove(Sender: TObject);
    procedure tDstAfterBatchMove(Sender: TObject);
    procedure tDstBatchMoveProgress(Sender: TObject; PercentDone: Integer;
      var Continue: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure InitTables;
  end;

var
  Form1: TForm1;

implementation
uses ABSTypes;

{$R *.dfm}

procedure TForm1.InitTables;
begin
  with tSrc do
    begin
      Close;
      FieldDefs.Clear;
      FieldDefs.Add('id', ftAutoInc, 0, False);
      FieldDefs.Add('name', ftString, 10, False);
      FieldDefs.Add('code', ftInteger, 0, False);
      FieldDefs.Add('address', ftString, 10, False);
      IndexDefs.Clear;
      IndexDefs.Add('pk_code','code',[ixPrimary]);
      CreateTable;
      Open;

      Insert;
      FieldByName('name').AsString := 'Johnny';
      FieldByName('code').AsInteger := 10;
      FieldByName('address').AsString := 'USA';
      Post;

      Insert;
      FieldByName('name').AsString := 'Piter';
      FieldByName('code').AsInteger := 12;
      FieldByName('address').AsString := 'Germany';
      Post;

    end;

  with tDst do
    begin
      Close;
      FieldDefs.Clear;
      FieldDefs.Add('code', ftInteger, 0, False);
      FieldDefs.Add('name', ftString, 10, False);
      FieldDefs.Add('lastname', ftString, 10, False);
      IndexDefs.Clear;
      IndexDefs.Add('pk_code','code',[ixPrimary]);
      CreateTable;
      Open;

      Insert;
      FieldByName('code').AsInteger := 10;
      FieldByName('name').AsString := 'John';
      FieldByName('lastname').AsString := 'Smith';
      Post;

      Insert;
      FieldByName('code').AsInteger := 11;
      FieldByName('name').AsString := 'Andrew';
      FieldByName('lastname').AsString := 'Harrison';
      Post;

    end;
  pb.Position := 0;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  InitTables;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
  InitTables;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  //tSrc.BatchMove(tSrc, TABSBatchMoveType(rgType.ItemIndex), 'pk_code');
  tDst.BatchMove(tSrc, TABSBatchMoveType(rgType.ItemIndex));
end;

procedure TForm1.tDstBeforeBatchMove(Sender: TObject);
begin
  pb.Position := 0;
end;

procedure TForm1.tDstAfterBatchMove(Sender: TObject);
begin
  pb.Position := 100;
end;

procedure TForm1.tDstBatchMoveProgress(Sender: TObject;
  PercentDone: Integer; var Continue: Boolean);
begin
  pb.Position := PercentDone;
end;

end.



Delphi Batch Move 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 Sep 22, 2017