DELPHI ClientData use Comments

In the three-tier structure, TClientDataSet status is immeasurable, she's correct or not, is crucial,
this article describes her use of the following aspects, I hope for your help.

1. Dynamic index
procedure TForm1 .DBGrid1TitleClick (the Column: TColumn);
the begin
    IF (not column.Field TBlobField iS) can not index the then // TBlobField binary
       ClientDataSet1.IndexFieldNames: = column.Field.FieldName;
End;

2. realize the multilayer structure from the master table

   primary table provided ClientDataSet1.packetrecord -1, all records
   provided from table ClientDataSet1.packetrecord is 0, the current record

 
3.Taggregates use
(1) In the field of editing to add new field type aggregates
    After setting Exp ression
    set Active: = true can be
    used in the field of the former to Dbedit
 
(2) add Aggergates property designed to express retried
  ShowMessage (floattostr (ClientDataSet1.Aggregates.Count));
  ShowMessage (ClientDataSet1.Aggregates.Items [0] .Value);
4. Do not in a single layer BDE database

   used instead of table ClientDataSet using loadfilename loaded cds ClientDataSet the
   place of the table tablename of db or dbf
   original program transformation method:
   add a ClientDataSet, right-assign locate data
   after savetofile, then loadfromfile, after deleting the table
   the original table's datasource set ClientDataSet even
   unique Note that: to midas.dll copying system or the current directory

implementation 5. briefcase three-layer structure
   while setting. 1: filename (. * CDS) 2.Remote Server

6. the data to be assigned (from another a set of data values)
    ClientDataSet2.Data:=ClientDataSet1.Data;
    ClientDataSet2.Open;
or
   ClientDataSet2.CloneCursor (ClientDataSet1, to true);
   ClientDataSet2.Open;

7. The additional data acquisition
   client request data to the application server. If the TClientDataSet FetchOnDemand attribute set to True,
   the client program such as content or nested table values BLOB field needed to automatically retrieve additional data packets.
   Otherwise, the client needs to explicitly call GetNextPacket to get these additional data packets.
   ClientDataSet number of records obtained in a set packetrecords

8.ClientDataSet query the server connection method
(. 1) is empty sql
        ClientDataSet1.Close;
        ClientDataSet1.CommandText: = Edit1.Text; // sql i.e. content
        ClientDataSet1.Open;
        for no the application server such as filter settings: Country like 'a%'
       Filtered = sql function may be implemented to true
(2) parameters
      such as the sql server query to
      select * from animals where name like: dd
     then: client ClientDataSet
var
   PM: Tparam;
the begin
   ClientDataSet1.Close;
   ClientDataSet1.ProviderName: = 'DataSetProvider1';
   PM: = Tparam.Create (nil);
   pm.Name:='dd ';
   pm.DataType: = ftString;
   ClientDataSet1.Params.Clear ;
   ClientDataSet1.Params.AddParam (PM);
  ClientDataSet1.Params.ParamByName ( 'dd') AsString:. = Edit1.Text;
  ClientDataSet1.Open;
  pm.Free;
End;

update management data 9.
(1) savepoint currently saved until the data state to be restored to the state
var
   PP: Integer;
the begin
  PP: = ClientDataSet1.SavePoint;
  ClientDataSet1.Edit;
  ClientDataSet1.FieldByName ( 'name') .asstring: = 'old saying';
  ClientDataSet1.Post;
  table1.Refresh;
End;
recovery point
  ClientDataSet1.SavePoint: = PP;

(2) the Cancel, RevertRecord
    cancel modifications to the current record, not only for the post, if the post, call
    RevertRecord

(3) CancelUpdate
    cancel the database All modifications

(4) UndoLastChange (boolean), changecount
    a cancellation of modifications can be undone continuous
   parameter is true: restore the cursor to the
   false: the cursor does not move the current position
   ChangeCount returns the number of modified records, modifying a record multiple times return only once
   but only undo once UndoLastChange

10. the writable recno
     for Ttable Tquery and the recno is read-only, and read and write the TClientDataSet recno
     ClientDataSet1.recno: = 5; provided is the fifth record is the current record

11. the data storage
     for post table using updatable data
     and the post ClientDataSet1 only memory data update, data to be used to update the server
    ApplyUpdates (MaxErrors: Integer), he had an argument, is allowed to send the wrong
    number, -1 means countless times, often using simpleobjectbroker set to 0, automatic fault tolerance and load balancing

Guess you like

Origin www.cnblogs.com/jijm123/p/11272055.html