Knowledge Base

FP97: Syntax Error If Query Contains Parameter Values

Article ID: 159435

Article Last Modified on 6/25/2007


APPLIES TO


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: 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:

Additional query words: 97

Keywords: kbnetwork kbprb KB159435