PRB: ClassWizard Binds Fields in Incorrect Order Causing Errors (186198)
The information in this article applies to:
- The ClassWizard, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q186198 SYMPTOMS
When you use the AppWizard to create a database application that uses the
CRecordset class, fields are listed in the DoFieldExchange function in
table order. However, if you use the ClassWizard to bind columns to
variables, the fields are listed in alphabetical order. The order in which
the fields are listed presents no problem as long as the default SQL
statement provided by the wizard is used.
The default SQL statement is the table name in square brackets and is
located inside the GetDefaultSQL function. Using a statement such as
"Select * From Tablename" can result in errors when the fields are out of
order. The errors can be different, depending on the data types represented
by the fields and the variables they are bound to.
Some possible error messages you might receive because the fields in
DoFieldExchange are out of order are: - Invalid Character Value for Cast Specification
- Restricted Datatype Attribute Violation
- Error in Assignment on Column Number [x]
- Error Retrieving Record
There may also be other errors depending on the data types involved.
RESOLUTION
If you need to supply a SQL Select statement make sure the items in the
DoFieldExchange function are in the same order as the fields in the select
statement or in table order.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/10/2003 |
---|
Keywords: | kbDatabase kberrmsg kbpending kbprb kbwizard KB186198 |
---|
|