Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 2 - Using the Client Dataset in Two-Tiered Cli...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Using the Client Dataset in Two-Tiered Client/Server Applications
By: Danish Ahmed
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2007-12-26

    Table of Contents:
  • Using the Client Dataset in Two-Tiered Client/Server Applications
  • Two-Tiered Architecture
  • Using Data-Aware Components with the Client Dataset
  • Navigating and Modifying Data Programatically

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Using the Client Dataset in Two-Tiered Client/Server Applications - Two-Tiered Architecture


    (Page 2 of 4 )

    A two-tiered client-server program is divided into two parts, a server and a client which interact with each other over a network. A data storage mechanism is implemented in the server, which allows the client to connect to itself and transact data. A server normally doesn't interact with the end user; it receives requests from the client application, processes them and sends a reply to the client application.

    A client, on the other hand, interacts directly with the end user, usually through a graphical interface. It acts as an intermediary between the user and the server.

    The two-tiered architecture is based on pretty simple logic, and for that reason it is best suited to performing simple tasks in environments with a small number of users. But even then, if the number of transactions is slightly larger, the network may be overloaded, thus degrading the performance. As I have said earlier, the client dataset component can be used to cache data locally and commit all changes to the server in a single transaction. Using the client dataset in a two-tiered application can help drastically reduce network traffic and enhance  performance. So let us take a look at how the client dataset can be used in a two-tier database application.

    A distinctive feature of the client dataset is that by itself, it cannot connect to a database source and requires a TDataset Provider class to interact with the data source. The TClient Dataset component points to the dataset provider through its Provider Name property. You can link the client dataset to its dataset provider during design time by selecting the name of the instance of the TDataset Provider in the Object Inspector and during runtime, it can be specified in a single statement.

     

    CDS11.ProviderName:=DataSetProvider1;



    The dataset provider in its turn needs to point to another dataset which is linked to the database. This can be done by specifying the dataset's name in the "dataset" property of the dataset provider. When the client dataset is opened it sends a request to the dataset provider which opens the dataset pointing to the external data source, fetches data, converts it to data packets and closes the dataset. It then passes these data packets to the client dataset, which decodes them and loads them into memory, keeping the original structure intact. Another method which you can use to specify the provider to the client dataset is the SetProvider method.

     

    CDS11.SetProvider(DataSetProvider1);


    This method can be called to link the client dataset to the dataset provider when the latter resides in the same application but has a different owner. In all other instances the Provider Name property should be used to associate the client dataset with the dataset provider.

    In fact, the SetProvider method cannot be used when the provider resides in a remote module; further, the provider you intend to associate with the client dataset has to be a descendant of the TCustomProvider class or else an exception is raised. If you really have to use this method, do remember that this method associates the provider with the client dataset as long as it is open and the linkage is lost when the dataset is closed. So every time you open the client dataset you have to assign the provider using the same method. In contrast to using this method, assigning a provider to a client dataset using its ProviderName property is a much simpler and effective way.

    The client dataset allows you to retrieve specific records from its internal and external providers by using its CommandText property. This property can be assigned an SQL statement, table name or stored procedure. When the dataset is opened or the Execute method is called and the CommandText property is not blank, the value held by it is sent to the server through the provider and the result set is sent back to the client dataset.

    Do remember that the dataset provider's Option property should have poAllowCommandText set to true to send the CommandText value to the server. It should also be noted that any data held by the client dataset after it has been associated to a data source is replaced with the data retrieved by the execution of the CommandText.

    More Delphi-Kylix Articles
    More By Danish Ahmed


     

    DELPHI-KYLIX ARTICLES

    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...
    - Using the Client Dataset in Two-Tiered Clien...
    - Using the Client Dataset in File-Based Archi...
    - Demystifying the Client Dataset
    - Working with INI Files in Delphi
    - Creating Data Link (UDL) Files in Delphi
    - Looking at the Details for an Invoicing Appl...
    - Invoicing in Delphi: Show Me the Money
    - Saving Images and Binary Files to a Database...
    - Saving Files to a Database using Delphi: Sav...
    - Creating CF Applications and Integrating a S...
    - Using Try and Finally to Help Prevent Memory...
    - The Implementation of an FTP Server
    - FTP Server: The Theory







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway