Delphi dbgrid row cannot be located for updating

13 Sep

When working with data manipulation language (DML) SQL statements, it is generally necessary to prepare the query or stored procedure prior to its execution.Likewise, since the act of preparing a query or stored procedure involves the allocation of resources on the server, it is necessary to unprepare the query or stored procedure when done.The alternative to using a data module is to place a different set of data set components on each form in your application.While there is certainly nothing fundamentally wrong with this approach, it means that every form contains data set components that must be individually configured.The most common components to place on a data module are datasets (including TTable, TQuery, TStored Proc, and TClient Data Set components).Many developers also like to place TData Source components on the data module as well.

delphi dbgrid row cannot be located for updating-7delphi dbgrid row cannot be located for updating-75

If you are working with a query or stored procedure that is executed repeatedly, therefore, it is critical that you explicitly prepare the object prior to its first activation, and only unprepare it after it is de-activated for the last time.

If the Data Source component appears on the data module, switching a form from using one data module to another requires that the Data Source property for every data-aware control on the form be changed.

Depending on the number of data-aware controls, this may be a major task.

The Visual Component Library (VCL) provides a number of components that greatly simplify database development.

These include the components on the Data Access page of the component palette, as well as those on the Data Controls page.