Replaceable Parameters in Command Strings

The connector can accept a replaceable parameter that allows for user input in most command strings (except for passthrough commands). Replaceable parameters cannot be used in command strings that specify a list of fields (that is, strings that have a SELECT clause).

The replaceable parameter character is "?" (question mark). Before the connector executes a command, it replaces all "?" characters in the command with the values that you have specified for the parameters. The parameters have relative positions within the command. The first "?" that occurs in the command is related to the first parameter value, the second "?" is related to the second parameter value, and so on. The following are two examples of a database query with two replaceable parameters:

Replaceable parameters are the preferred way for specifying application values in the "WHERE" portions of command strings.

There are two ways to specify parameters depending on the version of OLE DB Object Services you are using. When a parameter name is surrounded in single quotes, the actual parameter name will appear in output. If single quotes are not used, the words "Param1," "Param2," and so on substitute for parameter names.

Example 1:

dme:FILE=EMPLOYEE&FIELD=EMPLOYEE;LAST-NAME;FIRST-NAME; EMP-STATUS&SELECT=COMPANY%3D'?Company'%26LAST-NAME%3D'?Last-Name'

where %3D is equivalent to an equals sign and %26 is equivalent to an ampersand, but are used here for greater compatibility among different web servers

This example returns the parameter name in the output (in this case, Comapny and Last-Name).

Example 2:

dme:FILE=EMPLOYEE&FIELD=EMPLOYEE;LAST-NAME;FIRST-NAME;EMP-STATUS&SELECT=Company=?&SELECT=First-Name=?

This example returns Param1 and Param2 in place of actual parameter names.