Microsoft KB Archive/113246

{|
 * width="100%"|

BUG: AppWizard and Table with Many Columns May Cause Error

 * }

Q113246

-

The information in this article applies to:


 * The AppWizard, included with:
 * Microsoft Visual C++, version 1.5

-

SYMPTOMS
AppWizard issues the following error message when trying to create a database application that uses a database table containing a large number of fields (number of fields varies depending on the field name lengths):

Not enough memory to complete operation.

AppWizard may also cause the Visual Workbench to hang in this situation.

RESOLUTION
The workaround is to use AppWizard to generate a "database enabled" application. This is accomplished by using another table within the same data source as the table with many columns. However, this other table, henceforth referred to as the "proxy," does not cause AppWizard to fail when generating the application. After the application has been successfully generated, ClassWizard is then used to modify the code to use the table with many columns instead of the proxy. One other change also requires the modification of a single line of code.

The following is a step-by-step approach to using this technique:

 Identify another table, the proxy, which contains fewer columns in the same data source, or create one. Using AppWizard, create a skeleton application selecting all of the originally desired options. When choosing the data source, use the proxy table identified in step 1. Open ClassWizard (CTRL+W) and switch to the "Member Variables" tab. For the "Class Name," select the CRecordset derived class (it should be a name that ends with "Set"). Delete the CRecordset member variables associated with each of the column names in the proxy table. Do this for every member variable by selecting a "Column Name" and clicking "Delete Variable." Now click "Update Columns." Choose "Yes" when prompted to save current changes. Select the data source that has been used during this process and choose OK. Select the table with the large number of columns and choose OK.</li> Click "Bind All" to add variables for all of the columns in the new table.</li> Choose OK to leave ClassWizard.</li> Edit the implementation file (.CPP) for the CRecordset derived class (the filename should be of the form xxxxSET.CPP).</li>  Change the "GetDefaultSQL" for the CRecordset derived class provided by AppWizard. Change the code to read  <pre class="CODESAMP">      return "XXXXX"; where XXXXX is the name of the table with many columns. </li> Save changes by choosing Save from the File menu.</li></ol>

At this point the code is identical to what AppWizard would have generated had it worked successfully using the table with many columns. Code development may proceed as usual using this code.

STATUS
Microsoft has confirmed this to be a bug in the 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 INFORMATION
For information about adding additional CRecordset and CRecordView classes, see Chapter 9 of the App Studio "User's Guide." Also see the section titled "Creating a Recordset for the Course Table" in Chapter 4 of "Database Classes," "Part 1: Database Tutorial."

Steps to Reproduce the Problem
The following steps show how the problem can be produced:


 * 1) Create a database with one table containing a large number (80-120 depending on the field name lengths) of fields of any type.
 * 2) Set up an ODBC data source to refer to the new database and table.
 * 3) Run AppWizard.
 * 4) After setting up the project name, directory, and other options, select "Database Options."
 * 5) Select either "Database and File Support" or "Database Support, No File Support."
 * 6) Select "Data Sources," and choose your table name from the list.
 * 7) Choose OK four times to let AppWizard create the classes.

At this point, you'll get the error message listed above.

Additional query words: 1.50 enough memory hang datasource mfc

Keywords : kb16bitonly

Issue type : kbbug

Technology : kbVCsearch kbAudDeveloper kbAppWizard