The information in this article applies to:
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.
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.
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:
STATUSMicrosoft 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. MORE INFORMATIONIf you attempt to execute a query in the Query Builder that contains expressions and you are connected to an Access database, the design-time controls always assume the type of the expression is a string. This means that internally they always put single-quotes around the expression before executing it. This works fine if you are comparing against a text field. However, it will fail if you are coming against a numeric field. Since the design-time controls assume it is a numeric field in this case, the user has control over whether quotes are put around the expression. Steps to Reproduce Behavior
This SQL is incorrect because single quotes are missing around the string parameter "CatName". The expected SQL should be as follows:
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:
http://support.microsoft.com/support/vinterdev/ Additional query words:
Keywords : kbVisDBTools kbVisID100 kbGrpASP kbDtQDesigner |
Last Reviewed: November 8, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |