ExecuteSQL

Runs a SQL statement on the Lookup database. If a SELECT statement returns one or more values, these values are stored in an internal data record that you can access by using the PopulateWithResult action.

Syntax

bool ExecuteSQL (sStringIn)

Parameters

  1. The SQL expression that you want to run surrounded by quotation marks (" "). '%s' or %s can be substituted in the SQL expression to represent a field value.
    • If %s represents a text field, it must be surrounded by ' '.
    • If %s represents a numeric field, it appears without surrounding apostrophe characters.
  2. ,3+ Field names whose captured values you want to use in the SQL expression (see the example).

Returns

True, if the SQL statement runs successfully, select statements must also return a value. False, if it does not.

Level

All.

Details

Runs the SQL statement that you enter in the first parameter. Field values can be substituted for "%s" in the statement.
Example:

This sequence opens a connection to the InvoiceLook database. Next, it inserts values into the CompanyCode and Type columns of the Vendor table:

OpenConnection("@APPVAR(*/lookupdb:cs)")
ExecuteSQL("INSERT INTO Vendor (CompanyCode,Type) VALUES ('MQSW','New')")

Here, dbVendorID is a numeric field, while dbVendorname is a text field.

OpenConnection("@APPVAR(*/fingerprintconn:cs)")
ExecuteSQL(""SELECT CompanyCode  FROM Vendor WHERE dbVendorID = %s AND dbVendorName = '%s';",VendorID,VendorName")