Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 Single Tier Applications


How do I set up a single tier application using Client Datasets?   

    Currently, the only way to activate a client dataset at design time is to associate it with a provider, to load data from a file, or to assign data from another dataset. Typically, for a single tier application you would create the dataset at runtime using the CreateDataSet method. Here is how you might code the FormCreate and FormDestroy methods:

    ?
    ?OnFormCreate:?

    if FileExists('MYDATCDS') then ClientDataSet.LoadFromFile('MYDATA.CDS') else begin ClientDataSet.FieldDefs.Add('Field ', etc.); ClientDataSet.FieldDefs.Add('Field2', etc.); ClientDataSet.CreateDataset; end;

    ?OnFormDestroy:?

    if ClientDataSet.Active then begin // Next line is optional, // if you don't want undo support you could // set LogChanges = False instead. ClientDataSet.MergeChangeLog; ClientDataSet.SaveToFile('MYDATA.CDS'); end; ?

    Once you've run the app once and created the data file, you can easily load it at design time (from the right-click component menu) if you need to have the dataset active at design time for some reason.

     



  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use