FIX: SELECT - SQL from Table with 252 Fields Causes Page Fault

Last reviewed: October 29, 1997
Article ID: Q162072
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 5.0

SYMPTOMS

Issuing a SELECT - SQL statement using a table that has more than 251 fields may cause Visual FoxPro to terminate with an Invalid Page Fault.

NOTE: This behavior has been duplicated with as few as 190 fields under a variety of conditions (projects open, variables in memory, and so forth). The exact number of fields that causes this behavior may vary.

RESOLUTION

The workaround to the Invalid Page Fault is to perform the SQL SELECT as identified in the second and third SELECT statements in the "Steps to Reproduce Behavior" section below.

   SELECT *, .T. FROM <table>

   -or-

   SELECT * FROM <table> INTO CURSOR <cursorname> NOFILTER

STATUS

This problem has been fixed in Visual FoxPro 5.0a.

MORE INFORMATION

Issuing a SELECT - SQL statement using a table that has more than 251 fields may cause Visual FoxPro to terminate with an Invalid Page Fault. The following code creates a table with 252 fields, inserts a single record, and performs three different SQL SELECT statements. Generally, the first SELECT statement causes an Invalid Page Fault.

Steps to Reproduce Behavior

Create and run a program with the following code:

   fldlist="("
   FOR i = 1 TO 251
        fldlist=fldlist+"fld"+ALLTRIM(STR(i))+" C(5),"
   ENDFOR

   fldlist=fldlist+"FLD"+ALLTRIM(STR(i))+" C(5))"

   valuelst=""
   valuelst=valuelst+REPLICATE("'"+'DATA'+"', ",i-1)+"'DATA'"

   CREATE TABLE manyflds FREE &fldlist
   INSERT INTO manyflds VALUES (&valuelst)

   SELECT * FROM manyflds        && Causes an Invalid Page Fault in VFP 5
   SELECT *,.T. FROM manyflds    && Works fine
   SELECT * FROM manyflds INTO CURSOR temp NOFILTER  && Works fine
Keywords          : FxprgSql FxprgTable vfoxwin vfpfix5.0a kbprg kbbuglist kbfixlist
Version           : 5.0
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.