Home arrow Delphi-Kylix arrow Page 3 - Client Dataset: Working with Data Packets and Applying Updates

Client Dataset: Working with Data Packets and Applying Updates

This article is the fifth part of my series on the Client Dataset available in Delphi. It will focus on how to work with data packets by using the features of client dataset/dataset provider components.

Author Info:
By: Danish Ahmed
Rating: 5 stars5 stars5 stars5 stars5 stars / 8
January 09, 2008
  1. · Client Dataset: Working with Data Packets and Applying Updates
  2. · Reconciling Errors
  3. · Information in Data Packets
  4. · Specific Fields and Custom Information

print this article

Client Dataset: Working with Data Packets and Applying Updates - Information in Data Packets
(Page 3 of 4 )

Working with information in data packets

TClientDataset/TDataset Provider components offer a number of ways to control data packets that are being transacted.

Using the Options property of the Dataset Provider

The Dataset Provider's Options property lets you specify a number of conditions that can be imposed when transacting data. To specify these conditions during design time, you can access these properties in the Object Inspector by expanding the Options property of TDataset Provider. To control what data manipulation operations are on the server, you can use the following options:  poDisableEdits, poDisableInserts, or poDisableDeletes.

Setting poDisableEdits to true ensures that no existing record is modified, but it does not restrict the user from inserting a new record or deleting an existing one. poDisableInserts prevents the user from inserting a new record but it allows the user to edit or delete existing records, if the poDisableEdit and poDisableDeletes options are set to false. Finally, poDisableDeletes prevents the user from deleting records, but does not restrict the user from inserting or editing it. If you want to prevent any change to the data set the  poReadOnly property to true.

The client dataset stores data locally, which also implies that it will always exert pressure on system resources. For this reason the client dataset does not retrieve some data, like BLOB data, by default; instead it requests it and retrieves it automatically when the need arises. Alternatively, you can also call the FetchBlobs method to load BLOB data to the dataset. However, it requires that the provider's poFetchBlobOnDemand option and the client dataset's FetchOnDemand property be set to true.

As with BLOB data, data in the details tables of a master/detail relationship are not retrieved by default. Rather, they are retrieved only when they are needed or by using the client dataset's FetchDetails method. To enable the retrieval of records from the details table, ensure that the poFetchDetailsOnDemand property is set to true. Apart from this there are two more options that assume significance when working with the dataset representing the master/detail relationship.

poCascadeDeletes : This option provides that when a master record is deleted, the corresponding values in detail tables are deleted too.

poCascadeUpdates: If this option is enabled, values in the details tables are updated automatically when the master record is updated.

You also need to set the poAllowCommandText property to true, if you want to retrieve specific sets of records using SQL, table name or stored procedure. If this property is enabled the command text is sent to the server and records returned are sent back to the client dataset. But if this property is set to false, the CommandText property of the client dataset has no impact and the associated dataset is used as the data source.

Besides these, there are many other properties of the DatasetProvider's Option property. Refer to Delphi documentation for a complete list and descriptions.


I should mention here that if you want to apply changes to the source dataset (make sure the dataset is not read-only), you can set the Dataset Provider's ResolveToDataSet property to true.

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-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials