BUG: Incorrect SQL Generated for Access Query with String Parameter (172898)
The information in this article applies to:
- Microsoft Visual InterDev 1.0
This article was previously published under Q172898 SYMPTOMS
The design time controls in Visual InterDev version 1.0 generates incorrect
SQL in Active Server Pages (ASP) for an Access query with a string
parameter. Single quotes are missing around the string parameter in the SQL
statement.
When attempting to run the page with the invalid SQL the following error
message may be seen:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters.
Expected 1.
/SamplesWeb/KBTestFolder/KBTest.asp, line 31
CAUSE
The Access ODBC driver does not support parameterized queries. As a result,
the design-time control has no way of determining the expected type for
each expression when using an Access data connection.
When setting up criteria inside Visual InterDev's Query Designer the
criteria should be entered in the following format to enable the query to
run inside the Query Designer for testing purposes:
= [CatName]
The problem is occurs when the Query Designer is closed and incorrect SQL
is then written to the ASP page.
RESOLUTION
The only workaround for this problem is to put single quotes outside the
square brackets when entering the parameterized query. This forces the SQL
being generated to include single quotes around the String parameter.
However, this will break the ability to execute the query in the query
builder. The criteria should be entered as follows:
= '[CatName]'
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. We are researching this bug and will post
new information here in the Microsoft Knowledge Base as it becomes
available.
REFERENCES
For the latest Knowledge Base articles and other support information on
Visual InterDev and Active Server Pages, see the following page on the
Microsoft Technical Support site:
Modification Type: | Major | Last Reviewed: | 5/2/2006 |
---|
Keywords: | kbbug kberrmsg kbpending KB172898 |
---|
|