Updating SQL Tables
Here we'll demonstrate how to use the SQL INSERT, DELETE and UPDATE commands. Although these commands can be used to insert new records, delete old records, and update the data within existing records, you should note that the method demonstrated here is a very low-level approach. The Database Application Components of RADpage contain a much more efficient method of performing these tasks.
First we demonstrate how to insert a new record into a sample Guestbook Table:
As you can see, we've used the heitml ? Tag above to evaluate the contents of the ff.fieldname expressions and pass the result along to SQL for insertion into the database. Additionally, we specified the "Q" argument to ensure that the result was treated as a quoted string. The effect is the same as if we had done the following:
Experienced programmers know, however, that this literal method of INSERT-ing records into a file is too specific to be useful in real-world applications, but as stated above, there are times when it can be expedient for a programmer to perform operations directly on a Table using little code fragments.
To DELETE a record from an SQL TABLE we could, again, do it by referencing the contents of a variable, or by matching a literal as follows:
By referencing a variable:
By matching a literal:
Finally, the syntax of the SQL UPDATE command could be illustrated as follows:
© 1996-2024 H.E.I. All Rights Reserved.