Microsoft KB Archive/191356

= PRB: Wizard Doesn't Generate Column or Param Map for Jet =

Article ID: 191356

Article Last Modified on 3/2/2005

-

APPLIES TO

 Microsoft OLE DB 2.7, when used with:  Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Professional Edition

 Microsoft Visual C++ 6.0 Standard Edition 

-

<div class="notice_section">

This article was previously published under Q191356

<div class="symptoms_section">

SYMPTOMS
Using the ATL OLE DB Consumer Wizard with a Jet Query causes the Wizard to not generate column maps and parameter maps in the accessor class that it creates.

<div class="cause_section">

CAUSE
The Microsoft Jet 3.51 OLE DB Provider does not support the PROCEDURE_COLUMNS or the PROCEDURE_PARAMETERS rowsets, which are required for the ATL wizard, to provide necessary information for generating the column and parameter maps.

<div class="resolution_section">

RESOLUTION
The following are two suggested workarounds for these issues.

Workaround 1: Generating Correct Column Map for Jet Queries with Microsoft Jet 3.51 Provider
<ol> Create a Jet table that returns the same columns as the Jet Query.</li> Use the Consumer Wizard on the Jet table instead of the Query.</li>  Change the generated DEFINE_COMMAND macro <TableName>.h file so that it references the query instead of the table; for example DEFINE_COMMAND(CEmpAccessor, _T(" \        SELECT \           id, \           fname, \           lname  \         FROM emp")) becomes the following: DEFINE_COMMAND(CEmpAccessor, _T(" \        SELECT \           id, \           fname, \           lname  \         FROM empQuery")) </li></ol>

Workaround 2: Generating Correct Parameter Map for Jet Queries with Microsoft Jet 3.51 Provider

 * 1) Use the Consumer Wizard on the Jet Query (that uses parameters) with the Microsoft Jet 3.51 OLE DB Provider as you would expect. Note the missing column and parameter maps in the <QueryName>.h file.
 * 2) In a temporary project, use the Consumer Wizard with the Microsoft OLE DB Provider for ODBC providers with the Jet Query. This provider creates the proper column and parameter maps.
 * 3) From the temporary project in step 2, copy the C<QueryName>Accessor class generated in the <QueryName>.h file.
 * 4) Replace the C<QueryName>Accessor class in your real project with the one copied from step 3.
 * 5) Finally, the Microsoft Jet 3.51 Provider does not support the command syntax that the consumer wizard generates, and effectively does not support calling stored queries with parameters. To work around this limitation, the stored query text must be copied and used as the command text.

For example, Wizard output command: DEFINE_COMMAND(CQueryAccessor, _T("{ CALL EmpLName (?) }")) Change to Stored Query definition: DEFINE_COMMAND(CQueryAccessor, _T("PARAMETERS pId Short; SELECT        emp.lname FROM emp WHERE emp.id = pId;"))

<div class="status_section">

STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

This behavior is known to happen with the Microsoft Jet 3.51 Provider, version 3.52.1527.4, which shipped with Visual C++ 6.0.

<div class="moreinformation_section">

MORE INFORMATION
The Microsoft OLE DB Provider for ODBC in conjunction with the Access ODBC driver that shipped with Visual C++ 6.0 provide the necessary functionality for the Consumer Wizard to generate code that works in calling Jet Stored Queries.

Keywords: kbprovider kbconsumer kbmdac210fix kbdatabase kbjet kbprb kbwizard kbdtl kbmdacnosweep KB191356

-

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

© Microsoft Corporation. All rights reserved.