Microsoft KB Archive/195245

= PRB: Query Designer Creates Wrong SQL Statement on MDB Files =

Article ID: 195245

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Service Pack 5
 * Microsoft Visual InterDev 6.0 Standard Edition
 * Microsoft Visual Studio 6.0 Professional Edition
 * Microsoft Visual Studio 6.0 Enterprise Edition

-



This article was previously published under Q195245



SYMPTOMS
A database project uses an .mdb file for a database. When you use the Query Designer to create an SQL statement, the SQL pane displays an SQL sentence with the ODBC OJ syntax.



CAUSE
The Query Designers assumes that the transport mechanism to the backend database is ODBC and creates an ODBC-compliant syntax.



RESOLUTION
To workaround this problem, remove the ODBC syntax from the SQL statement.



STATUS
This behavior is by design.



MORE INFORMATION
This section demonstrates how to reproduce the behavior. To do this, you need to know how to use the Query Designer. In this example, you will create a connection to the NorthWind Access database (NWIND.MDB).

Steps to Reproduce Behavior
 Drag the Order Details and Products table into the Query Designer Window. The tables appear in the Diagram Pane with join lines. Click ProductName in the Products table and Quantity in the Order Details table.  Right-click the join line and click Select all Rows from Order Details. The following SQL statement appears in the SQL pane: SELECT FROM { oj `Order Details` LEFT OUTER JOIN Products ON `Order Details`.ProductID = Products.ProductID } 

RESULT: The SQL statement contains brackets and the ODBC OJ syntax.

Following is the correct SQL statement. SELECT FROM `Order Details` LEFT OUTER JOIN Products ON `Order Details`.ProductID = Products.ProductID

Keywords: kbdataenv kbdatabase kbprb kbpending KB195245

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.