Home arrow Delphi-Kylix arrow Using the Client Dataset in File-Based Architecture

Using the Client Dataset in File-Based Architecture

A client dataset can be used as a fully functional file-based dataset in a single-tier application as well as the client part of a multi-tiered application. A file-based application is the simplest form of database application, and it does not require a database server to save data in. Instead, it uses MyBase, the ability of client datasets to save themselves to a file and to load the data from a file.

Author Info:
By: Danish Ahmed
Rating: 5 stars5 stars5 stars5 stars5 stars / 5
December 19, 2007
  1. · Using the Client Dataset in File-Based Architecture
  2. · Adding FieldDefs
  3. · Adding IndexDefs
  4. · Loading and Saving Files

print this article

Using the Client Dataset in File-Based Architecture
(Page 1 of 4 )

For the purpose of demonstration let us create a very simple application that stores just four fields: first name, last name, phone number and email address. To create and use client datasets in an application that does not require a connection to the database server you can adopt one of the following three approaches.

The easiest approach to working with the client dataset without requiring a persistent server connection is by is copying data to the client dataset from another dataset. During design time this can be done by clicking on the Assign Local Data option available in the context menu of the client dataset component. When this option is selected, a list of available datasets is displayed and you can choose the one that contains the data you want to copy.

Well, this is the only time we will be using an external database. Once the data is copied to the client dataset you can delete the external dataset. The data as well as the structure is now contained in the client dataset component.

You can assign data to the client dataset from another data source during runtime by using the data property of the client dataset. To copy data from another client dataset component assign it using both datasets' data property.


However, to copy data from a dataset other than the client dataset, a dataset provider would be required. The dataset provider acts as an intermediary between the two datasets. It points to the dataset which is to be copied through its dataset property and the client dataset links to the dataset provider through its dataset property.



After copying data from the dataset you can delete it and the provider from the application; the client dataset is now self-contained and no longer needs them. When taking this approach you should remember that copying data is different from using the CloneCursor method. When copying data by calling Assign Data or using the data property the actual data is copied to the client dataset but when the CloneCursor method is called, the data is shared by the client dataset with the other dataset. Any modification of the data by one dataset is reflected in the other dataset.

blog comments powered by Disqus

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials