This sample chapter from Delphi/Kylix Database Development introduces the basic operations of client datasets, and explains how they can be useful standalone tools. Read on to learn how to create a client dataset, and how to populate, navigate, and manipulate it. Indexes, filters, and ranges are also covered.

This chapter is from the book

This chapter is from the book

In the preceding two chapters, I discussed dbExpressa unidirectional
database technology. In the real world, most applications support bidirectional
scrolling through a dataset. As noted previously, Borland has addressed
bidirectional datasets through a technology known as client datasets. This
chapter introduces you to the basic operations of client datasets, including how
they are a useful standalone tool. Subsequent chapters focus on more advanced
client dataset capabilities, including how you can hook a client dataset up to a
dbExpress (or other) database connection to create a true multitier
application.

What Is a Client Dataset?

A client dataset, as its name suggests, is a dataset that is located in a
client application (as opposed to an application server). The name is a bit of a
misnomer, because it seems to indicate that client datasets have no use outside
a client/server or multitier application. However, as you'll see in this
chapter, client datasets are useful in other types of applications, especially
single-tier database applications.

NOTE

Client datasets were originally introduced in Delphi 3, and they presented a
method for creating multitier applications in Delphi. As their use became more
widespread, they were enhanced to support additional single-tier
functionality.

The base class in VCL/CLX for client datasets is
TCustomClientDataSet. Typically, you don't work with
TCustomClientDataSet directly, but with its direct descendent,
TClientDataSet. (In Chapter 7, "Dataset Providers," I'll
introduce you to other descendents of TCustomClientDataSet.) For
readability and generalization, I'll refer to client datasets generically
in this book as TClientDataSet.