0% found this document useful (0 votes)
404 views

Batch Move Delphi Example

This document provides an example of how to move or synchronize records between two database tables using batch operations in Delphi. It initializes two tables with sample data, then demonstrates using the BatchMove method to transfer records from one table to the other while tracking progress with a progress bar.

Uploaded by

nagat4r
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
404 views

Batch Move Delphi Example

This document provides an example of how to move or synchronize records between two database tables using batch operations in Delphi. It initializes two tables with sample data, then demonstrates using the BatchMove method to transfer records from one table to the other while tracking progress with a progress bar.

Uploaded by

nagat4r
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

 

recent searches

Home > Delphi/C++ Components > Absolute Database > Batch Move Delphi Example
Delphi/C++ Components
.NET Components Absolute Database
Overview | Features | Requirements | Testimonials | SQL Samples | Code Samples | Screenshots | See Also | Download | Order
ActiveX Controls
Kylix Components Batch Move Delphi Example
Shows how to move / update / synchronize records between two tables.

Download Absolute Database | Learn more


Download
Download Commercial unit Main;
Trial Limitations
interface
{$I CompVer.inc}

uses
Submit Request {$IFDEF D6H}
Variants,
Support Options {$ENDIF}
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, DB, ABSMain, StdCtrls, Grids, DBGrids, ExtCtrls, DBTables,
ComCtrls;
Purchase
type
Competitive Upgrade TForm1 = class(TForm)
tSrc: TABSTable;
Premium Support
tDst: TABSTable;
Sales Policy DBGrid1: TDBGrid;
Upgrade Policy
DBGrid2: TDBGrid;
Button1: TButton;
License Types Label2: TLabel;
Label3: TLabel;
Button2: TButton;
dsSrc: TDataSource;
dsDst: TDataSource;
News rgType: TRadioGroup;
Mailing List pb: TProgressBar;
GroupBox1: TGroupBox;
Articles Label1: TLabel;
Testimonials procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure tDstBeforeBatchMove(Sender: TObject);
procedure tDstAfterBatchMove(Sender: TObject);
About Us procedure tDstBatchMoveProgress(Sender: TObject; PercentDone: Integer;
Partners var Continue: Boolean);
private
Links { Private declarations }
Contact Us public
{ Public declarations }
Link to Us 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.
Download Absolute Database | Learn more

        © 2003 - 2020 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database May 19, 2020 

You might also like