PRB: Microsoft ESQL for C Generates Compiler Error w/ an Array

Last reviewed: September 15, 1997
Article ID: Q173843
The information in this article applies to:
  • Microsoft Embedded SQL for C Programmer's Toolkit, version 6.5

SYMPTOMS

The Visual C/C++ compiler generates the following compile error.

   error C2231: '.iValue' : left operand points to 'struct', use ->

The following code attempts to use an array to hold iID, and will show the problem:

   //
   // Retrieves one row of results. The SELECT INTO statement is also a
   // singleton select
   EXEC SQL select iID
         INTO :gTest[iCount].iValue
         FROM tblTest
         where iID = 1;

CAUSE

The current version of the NSQLPREP utility is not designed to handle array structures.

WORKAROUND

To work around this problem, use a pointer as shown by the following code:

   EXEC SQL begin declare section;

      typedef struct   stTest
      {
         int   iValue;
      }   TEST;

      TEST *   pCurrent   =   NULL;

   EXEC SQL end declare section;
      .
      .
      .

   //
   // Can use a pointer to fill array
   pCurrent =  &gTest[iCount];

   //
   // Retrieves one row of results. The SELECT INTO statement is also a
   // singleton select
   EXEC SQL select iID
         INTO :pCurrent->iValue
         FROM tblTest
         where iID = 1;


Additional query words: ESQL E-SQL SQC
Keywords : ssrvesql_c SSrvProg kbcode
Version : WINDOWS:6.5
Platform : WINDOWS
Issue type : kbprb
Solution Type : kbworkaround


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: September 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.