DOCUMENT:Q135989 27-JUL-2001 [odbc] TITLE :BUG: SQLNumResultCols Returns Zero for the pcCol Argument PRODUCT :Open Database Connectivity (ODBC) PROD/VER:WINDOWS:2.5 OPER/SYS: KEYWORDS:kbprogramming kbBug kbISS ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Open Database Connectivity, version 2.5 ------------------------------------------------------------------------------- SYMPTOMS ======== When you use the ODBC 32-bit 2.50.0121 SQL Server driver along with the 2.50.3006 Cursor Library, SQLNumResultCols returns zero for the number of columns in the result set. This problem occurs only when the hstmt is in a positioned state. STATUS ====== Microsoft has confirmed this to be a problem in the 2.50.3006 version of the cursor library. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ The following steps reproduce the problem: 1. In the database, Create table test(col1 int, col2 char(10)) 2. insert test values(10,'Unchanged') Then, use ODBC Test: 1. Set connect option to use the cursor library. Allocate two statements, hstmt1 and hstmt2. On hstmt1, set the cursor type to 'Static', concurrency to 'Values', and cursor name to 'c1'. 2. Do a SQLPrepare on hstmt1 and "select * from test for update of col2". Execute this statement. SQLNumResultCols at this point returns a correct value. Do a SQLFreeStmt with SQL_CLOSE option. Execute hstmt1 again. Do a SQLExtendedFetch. 3. On hstmt2, do a SQLExecDirect on "update blow set col2='Changed' where current of c1". 4. On hstmt1, call SQLNumResultCols again. It returns zero. Since SQLNumResultCols is called on hstmt1 and not hstmt2, SQLNumResultCols should not be returning 0. Additional query words: mfc sql ====================================================================== Keywords : kbprogramming kbBug kbISS Technology : kbAudDeveloper kbODBCSearch kbODBC250 Version : WINDOWS:2.5 Issue type : kbbug ============================================================================= 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. Copyright Microsoft Corporation 2001.