FP97: Syntax Error If Query Contains Parameter Values (159435)



The information in this article applies to:

  • Microsoft FrontPage 97 for Windows with Bonus Pack

This article was previously published under Q159435

SYMPTOMS

When you use a query containing parameter values generated by the Internet Database Connector Wizard, the ODBC driver may return a syntax error in the query expression.

CAUSE

There are many possible causes for syntax errors in ODBC queries. If the parameter value you specified contains text, check to make sure the parameter is enclosed in single quotation marks. The FrontPage Database Connector Wizard doesn't insert single quotation marks around parameter values.

RESOLUTION

When you specify a parameter in an SQL statement that will contain text, enclose the parameter in single quotation marks.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

When FrontPage creates the IDC file, it cannot determine the type of value that will be used for a parameter. If the value in the parameter is numeric, the query will run without error. However, if the value in the parameter is text, the query will fail unless you enclose the parameter in single quotation marks.

If you insert the Input parameter in an SQL statement using the IDC Wizard, the resulting SQL statement may resemble the following:

Select * from Orders where Order = %Input%

This statement will select all records from the Orders table where the Order field is equal to the Input parameter. If the Order field in the Orders table is a numeric field, the query will function without error. If the Order field in the Orders table is a text field, the query will need to be adjusted as follows:

Select * from Orders where Order = '%Input%'

Microsoft FrontPage does not record or correct SQL statements. For support on SQL syntax, please consult your Database Management System's documentation.

For more information on Internet Database Connector technology, see Chapter 8, "Publishing Information and Applications," of the online documentation for Microsoft Internet Information Server. Note that Chapter 8 of this documentation is available at the following Web site: NOTE: Because the Microsoft Web site is regularly updated, the site address may change without notice. If this occurs, link to the Microsoft home page at the following address:

Modification Type:MajorLast Reviewed:10/1/2002
Keywords:kbnetwork kbprb KB159435