Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Quickly Share Data Between Datasets Using CloneCursor In This Native Windows Sample For Delphi

The CloneCursor sample shows you how to clone a dataset. To this end, the sample uses the CloneCursor method of the TFDDataSet class. Moreover, the sample uses other methods to determine whether the current record is within a specified range.

Location

You can find the CloneCursor sample project at:

How to Use the Sample

  1. Navigate to the location given above and open CDS_CachedUpdates.dproj.
  2. Press F9 or choose Run > Run.
  3. Click on the Use Connection Definition combo box and select an option.
    • Click on the CloneCursor button to clone the dataset.
    • Modify the Start range (OrderID) and End range (OrderID) labels.
    • Click on the CheckRange button.

Files

File in DelphiContains
CDS_CachedUpdates.dproj
CDS_CachedUpdates.dpr
The project itself.
fCachedUpdates.pas
fCachedUpdates.fmx
The main form.

Implementation

This sample uses three main components:

When you run the application, click on the Use Connection Definition combo box and select an option in order to define a connection. When you select an item of the combo box, the Active property of the cdsOrders table is set to True in order to open the dataset and read data from the database. Then, the sample displays a table using a TDBGrid component. Once the TDBGrid is filled, you can interact with the sample. Each of the following buttons implements an OnClick event to do what is described below:

Please refer to the next links for the source code of this Sample:

https://github.com/Embarcadero/RADStudio10.4Demos/tree/master/Object%20Pascal/Database/FireDAC/Samples/Comp%20Layer/TFDMemTable/CloneCursor

Exit mobile version