Databases Reference
In-Depth Information
Password: <Password for the user>
Template: <A URL of the HTML template file *.HTX>
SQLStatement:
+<Lines of the SQL statement>
+<Lines of the SQL statement>
There may be more than one SQL statement in the file. This feature will
be revisited in the following sections.
The IDC script used with the search screen is as follows:
Datasource:Tel_Directory
Username:
Password:
Template:Directory.htx
SQLStatement:
+SELECT id,FirstName,LastName,Tel from Directory
+WHERE LastName like '%lname%%' and FirstName like
'%fname%%'
A username or password has not been included for this sample. In a pro-
duction environment, one would definitely include a user ID and password,
or prompt the user for one using a login screen.
The SQL statement containing the SELECT statement will typically re-
turn a result set. The result set may be empty or contain one or more rows.
The HTML template file will have to handle the display of multiple rows.
The field names in the SELECT section reflect the names of the columns in
the database, and the parameter names in the WHERE clause reflect the
field names on the search HTML form. The parameters coming from the
HTML form are enclosed in percent signs (%). In this case, the percent
signs (%), are enclosed in single quotes so that the WHERE clause will con-
tain the correct syntax for a text field. In addition, it was desirable to allow
the user the flexibility of keying only the first few letters of the name. Also
included is an additional percent sign (%) that acts as a wild card character,
indicating that any string of characters can replace it. The final SQL state-
ment may look like:
SELECT id,FirstName,LastName,Tel from Directory
WHERE LastName like 'Smi%' and FirstName like '%'
Search WWH ::




Custom Search