Mega Code Archive

 
Categories / Delphi / ADO Database
 

When to use TSQLDataset and when to use TClientDataset

Title: When to use TSQLDataset and when to use TClientDataset ? TSQLDataset should be used for SQL statements which either do not return a result set or where the result set can be used in an unidirectional / read-only way. It is more efficient to use TSQLDataset than to use TClientDataset when dealing with unidirectional / read-only result sets. Note that it is possible to update a record using TSQLDataset with an SQL statement such as UPDATE customer SET credit=100 WHERE id=1234 TSQLDataset is very efficient when updating all the records in the table (especially when the table is on a remote computer) UPDATE customer SET credit=100 TClientDataset should be used if bi-directional support is required (for example to populate a TDBGrid), when the current record is to be updated or when a what-if type scenario is to be investigated.