Contact | Privacy | Datenschutzerklärung | Impressum

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:

  INSERT INTO guestbook
   (Guest_Name, Email, Address, Country, Guest_Comment)
   (<? ff.Guest_Name "Q">,
    <? ff.Email "Q">,
    <? ff.Address "Q">,
    <? ff.Country "Q">,
    <? ff.Guest_Comment "Q">)

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:

 INSERT INTO guestbook
  (Guest_Name, Email, Address, Country, Guest_Comment)
   'Wimpfenerstrasse 23, 68259 Mannheim',
   'I like  heitml.')

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:

  DELETE FROM guestbook
     Guest_Name = <? ff.Guest_Name "Q">

By matching a literal:

  DELETE FROM guestbook
     Guest_Name = 'John Smith'

Finally, the syntax of the SQL UPDATE command could be illustrated as follows:

  UPDATE guestbook
    SET  Guest_Name = <? ff.Guest_Name "Q">,
              Email = <? ff.Email "Q">,
            Address = <? ff.Address "Q">
   WHERE Guest_Name = <? Old_Guest_Name "Q">

This page was dynamically generated by the web application development tool RADpage of H.E.I. H.E.I. provides support, tools, and services like Webdesign in Mannheimm, the HTML/CSS 3D WebGL Animation Library taccgl, 3D Webdesign, and 3D Product Configurator (3D Produkt Konfigurator in German).

Selected blog articles : 3D Objects on HTML pages, CSS Transition Visibility, and CSS Transition Display.

© 1996-2024 H.E.I. All Rights Reserved.

Component Guide
  Language Guide
    Modular Pages
    Dynamic Pages
    Interactive Pages
      Creating FORMs
      Session Mode
      Search FORMs
      Scrolling Pages
      Email FORMs
      SQL Intro
        Defining Tables
        Updating Tables
        Querying Tables
  Language Ref.
  Component Ref.
  Class Library
  User Components
  New Features
  heitml 1
User Guide
Contact / Impressum