What is TDataSet?
Go Up to Understanding Datasets
TDataSet is the ancestor for all the dataset objects that you use in your applications. It defines a set of data fields, properties, events, and methods that are shared by all dataset objects.
TDataSet is a virtualized dataset, meaning that many of its properties and methods are virtual or abstract. A
virtual method is a function or procedure declaration where the implementation of that method can be (and usually is) overridden in descendant objects. An abstract
method is a function or procedure declaration without an actual implementation. The declaration is a prototype that describes the method (and its parameters and return type, if any) that must be implemented in all descendant dataset objects, but that might be implemented differently by each of them.
TDataSet contains abstract methods, you cannot use it directly in an application without generating a runtime error. Instead, you either create instances of
TDataSet’s descendants, such as
TClientDataSet, and use them in your application, or you derive your own dataset object from
TDataSet or its descendants and write implementations for all its abstract methods.
TDataSet defines much that is common to all dataset objects. For example,
TDataSet defines the basic structure of all datasets: an array of
TField components that correspond to actual columns in one or more database tables, lookup fields provided by your application, or calculated fields provided by your application. For more information about
TField components, see “Working with field components” in the Delphi Developer’s Guide.
The following topics are discussed in this chapter:
- Opening and Closing Datasets
- Determining and Setting Dataset States
- Navigating Datasets
- Searching Datasets
- Modifying Dataset Data
- Using Dataset Events