[Lazarus] SQLDb Query Insert, Update vs SQL

Michael Van Canneyt michael at freepascal.org
Wed Nov 4 15:27:37 CET 2009



On Wed, 4 Nov 2009, ik wrote:

> Hello,
>
> How exactly can I make the TSQLQuery work with the Insert query when I do
> "insert" action on TDBNavigator ?
> The same question with update.

Either you specify the SQL directly in the InsertSQL, UpdateSQL, DeleteSQL
properties.

Do this in the standard way as in Delphi using parameters:

UPDATE MYTABLE SET
   Field1 = :Field1,
   Field2 = :Field2
WHERE
   MyKeyField = :Old_MyKeyField;

and similar for insert/delete.

or you let SQLDB compute the queries for you, in which case you should
set the pfInKey flag of the ProviderFlags property of the key field, and
the pfInUpdate flag for all fields that must be updated.

Michael.




More information about the Lazarus mailing list