Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to send data from database by portions Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Sending data from database by portions 06-Jul-03
Category
DB-General
Language
Delphi 2.x
Views
155
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Vladimir Orlenko 

Some times we need send hugo quantity of data from MiddleWare Server to client 
application. If we do it one portion than user mast wait long time, but we can send 
this data by portions, when user is needed in it.

Answer:

Some times we need send hugo quantity of data from MiddleWare Server to client 
application. If we do it one portion than user mast wait long time, but we can send 
this data by portions, when user is needed in it. 

This is sample about getting portion of data from DataSetProvider and adding it to 
CLientDataSet. 

In my article "Accessing DataBase via 3th server" you can read how send data 
between applications usin INDY components. 

1   unit Unit1;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7     Dialogs, StdCtrls, Buttons, DB, DBTables, Provider, DBClient, Grids,
8     DBGrids, ExtCtrls, DBCtrls, IdBaseComponent,
9     IdAntiFreezeBase, IdAntiFreeze, JvSpecialProgress;
10  
11  type
12    TForm1 = class(TForm)
13      DataSetProvider1: TDataSetProvider;
14      Table1: TTable;
15      BitBtn1: TBitBtn;
16      DBGrid1: TDBGrid;
17      DBGrid2: TDBGrid;
18      DataSource1: TDataSource;
19      DataSource2: TDataSource;
20      ClientDataSet1: TClientDataSet;
21      BitBtn2: TBitBtn;
22      DBNavigator1: TDBNavigator;
23      IdAntiFreeze1: TIdAntiFreeze;
24      BitBtn3: TBitBtn;
25      JvSpecialProgress1: TJvSpecialProgress;
26      procedure BitBtn1Click(Sender: TObject);
27      procedure FormShow(Sender: TObject);
28      procedure BitBtn2Click(Sender: TObject);
29      procedure DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
30      procedure BitBtn3Click(Sender: TObject);
31    private
32      { Private declarations }
33    public
34      { Public declarations }
35      data: OleVariant;
36      records: integer;
37    end;
38  
39  var
40    Form1: TForm1;
41  
42  implementation
43  
44  {$R *.dfm}
45  
46  procedure TForm1.BitBtn1Click(Sender: TObject);
47  var
48    recs: integer;
49    j: integer;
50  begin
51    ClientDataSet1.Active := False;
52    data := DataSetProvider1.GetRecords(1, recs, ResetOption + MetaDataOption);
53    Showmessage(format('get %d Records', [recs, i]));
54    ClientDataSet1.AppendData(data, False);
55    ClientDataSet1.Active := True;
56  
57  end;
58  
59  procedure TForm1.FormShow(Sender: TObject);
60  begin
61    records := DataSetProvider1.DataSet.RecordCount;
62  end;
63  
64  procedure TForm1.BitBtn2Click(Sender: TObject);
65  var
66    recs: integer;
67    j: integer;
68  begin
69    data := DataSetProvider1.GetRecords(-1, recs, ResetOption + MetaDataOption);
70    ClientDataSet1.AppendData(data, False);
71    ClientDataSet1.Active := True;
72  end;
73  
74  procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
75  var
76    recs: integer;
77  begin
78  
79    case Button of
80      nbNext:
81        begin
82          if DBNavigator1.DataSource.DataSet.RecordCount data :=
83            DataSetProvider1.GetRecords(1, recs, ResetOption + MetaDataOption);
84          ClientDataSet1.AppendData(data, False);
85        end;
86    end;
87    nbPrior:
88    begin
89    end;
90    nbLast:
91    begin
92      if DBNavigator1.DataSource.DataSet.RecordCount data :=
93        DataSetProvider1.GetRecords(-1, recs, ResetOption + MetaDataOption);
94      ClientDataSet1.AppendData(data, False);
95    end;
96  end;
97  nbFirst:
98  begin
99  end;
100 end;
101 
102 end;
103 
104 procedure TForm1.BitBtn3Click(Sender: TObject);
105 var
106   recs: integer;
107 begin
108   JvSpecialProgress1.Maximum := records;
109   JvSpecialProgress1.Position := 1;
110   while ClientDataSet1.RecordCount data := DataSetProvider1.GetRecords(1, recs,
111     ResetOption + MetaDataOption);
112   ClientDataSet1.AppendData(data, False);
113   JvSpecialProgress1.Position := JvSpecialProgress1.Position + 1;
114 end;
115 end;
116 
117 end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC