The idc File

The idc file identifies the datasource, the return page template, and the SQL statement for IDC to use when the data is submitted. Begin this file by opening a new document in a text editor such as Notepad. The file you create will be called subscrib.idc.

Step 1

The Datasource field is used to identify an ODBC datasource for IDC to use. This datasource is the same one you set up earlier in this project. Identify the datasource for this transaction by adding the following code to the idc file:

  Datasource:subscribers 

Step 2

The Template field is used to identify an HTML extension (htx) file that acts as a template for the return page. This field should contain the complete path to the file. Add the following code to identify the HTML extension file to be used with this transaction:

  Template:c:\inetsrv\scripts\project1\subscrib.htx 

Step 3

The SQLStatement field is used to identify the SQL statement you want IDC to run when the idc file is called. This field can reference the form input variables used in the form. You reference these variables by using the NAME attribute as specified in the HTML page. Treat the variables as you would any SQL variables. For example, if you enclose the variables in single quotes, the variables will be read as strings. Add the following code to the idc file to insert the new data into the database:

  SQLStatement:
+INSERT INTO People (Name,Department,Email)
+VALUES (`%txtName%','%txtDept%','%txtEmail%') 

The plus signs in the statement are line continuation characters and are required at the start of each new line. When you have finished this file, save it with the name subscrib.idc in the folder \scripts\project1, which you created at the beginning of the project.

© 1996 by Scot Hillier. All rights reserved.