BUG: Wizards Create Invalid Column Names for QueryDef Join (139996)
The information in this article applies to:
- The AppWizard, when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
- The ClassWizard, when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
This article was previously published under Q139996 SYMPTOMS If you use AppWizard or ClassWizard to create a MFC DAO
recordset based on a predefined query (QueryDef) that joins tables that contain
columns with identical names, the application generates an exception when it
attempts to open the recordset. The exception indicates that:
'[table.column]' isn't a valid parameter name.
where table and column correspond to actual table and column
names in your database. Note In Visual C++ 6.0, the AppWizard creates a CdaoRecordset-derived class
for the application based on the query. At run-time, you receive the following error message: Invalid bracketing of
name '[table.column]' Note In
Visual C++ .NET 2002 and Visual C++ .NET 2003, the AppWizard creates a CRecordset-derived
class for the application based on the query. At
run-time, you receive the following error message: '' is not a valid name.
Make sure that it does not include invalid characters or punctuation and that
it is not too long. CAUSE The exception is thrown due to the incorrect manner in
which the wizards add delimiting brackets to the standard
table_name.column_name references in your CDaoRecordset-derived class's
DoFieldExchange. The wizards generate the following syntax:
[table.column]
The correct syntax is:
[table].[column]
RESOLUTION You must manually modify the DoFieldExchange of the CDaoRecordset-derived class or the CRecordset-derived class to
correct those column references that use the incorrect syntax. Follow these steps: - Do not add qualifiers to any columns that are not
duplicates. Qualifying columns where no ambiguity exists will result in errors.
For additional information, please see the following article in the Microsoft
Knowledge Base:
139994 Specifying Table Name with Column Name in MFC DAO
- Modify the wizard-generated code to delimit the table and
column names correctly. For additional information about the exact form of the
final column reference is described in detail, please see the following article
in the Microsoft Knowledge Base:
139997 Item not found in this collection" with MFC DAO Join
STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 1/6/2004 |
---|
Keywords: | kbBug kbDatabase kbpending kbwizard KB139996 kbAudDeveloper |
---|
|