BUG: SQLNumResultCols Returns Zero for the pcCol Argument (135989)



The information in this article applies to:

  • Microsoft Open Database Connectivity 2.5

This article was previously published under Q135989

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.

Modification Type:MajorLast Reviewed:7/27/2001
Keywords:kbBug kbprogramming KB135989