Delphi-Kylix
  Home arrow Delphi-Kylix arrow Using the Client Dataset in File-Based Arc...
Iron Speed
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  
Download TestComplete 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM Developerworks
 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 File-Based Architecture
By: Danish Ahmed
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2007-12-19

    Table of Contents:
  • Using the Client Dataset in File-Based Architecture
  • Adding FieldDefs
  • Adding IndexDefs
  • Loading and Saving Files

  • 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

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

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

    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.

    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.


    CDS1.Data:=CDS2.Data;

    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.

    DatasetProvider1.DataSet:=Table1;

    CDS1.Data:=DatasetProvider1.Data;

    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 Dataor 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.

    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 4 hosted by Hostway