Additional database development components appear on the Midas page of the component palette, but these are generally associated with multi-tier development, which is a special case, and are largely ignored in this paper.This paper provides you with an overview of a number of important techniques in general VCL database development.Since the preparation and unpreparation of a query or stored procedure requires time (including a network round trip as well as resource allocation on the server), it is best to minimize the number of times these operations are performed.

delphi dbgrid row cannot be located for updating-22

While this is often considered to be a matter of style, I prefer to place Data Source components onto the individual forms.

Doing so permits you to convert a form from using one data module to another by simply changing the Data Set property of the Data Source.

The significance of explicit versus implicit invocation of Prepare and Un Prepare is important when the query or stored procedure that you are working with is intended to be called repeatedly.

For example, parameterized queries, those that include one or more parameters, are often called repeatedly.

If two or more forms need to display the same data or event handlers (for providing client-side data validation, for example), placing those data sets on a single data module that is shared by the two or more forms provides for easier development and maintenance.

But data sets are not the only components that can be used with data modules.The difference in performance between explicitly and implicitly prepared queries is demonstrated in the Delphi project named PREPARE. The PREPARE project main form A data module is a form-like container.Unlike a form, however, a data module is never visible to the user.Whenever a query or stored procedure is explicitly prepared, by calling the Prepare method prior to activating the object, an implicit call to Un Prepare does not take place.In these cases it is necessary for you to also explicitly call Un Prepare when you are through with the object.If you are currently developing database applications that use the VCL you will not doubt be familiar with some of these techniques.