BUG: Dbreadtext Incorrectly Processes All Result Sets

Last reviewed: September 15, 1997
Article ID: Q173856
The information in this article applies to:
  • Microsoft SQL Server, version 6.5
BUG #: 16825 (Windows: 6.50)

SYMPTOMS

The SQL Server Books Online says the following:

   To read successive chunks of the same SQLTEXT or SQLIMAGE value, call
   dbreadtext until it returns 0 (end of row).

Zero (0) indicates the end of the row, and -1 indicates that an error occurred.

Sending the following batch results in three distinct result sets:

   select 1
   select pr_info from pub_info where pub_id = '0736'
   select 3

If you loop through dbresults, the first result set returns an integer column. You can use dbcoltype and dbnumcol to determine the column information and to help set up the proper dbbind and retrieve the integer column data. Your code will process all rows with dbnextrow calls and then call dbresults to begin processing the second result set.

The second result set contains the text column. The dbreadtext calls to process the results properly returns (0) to signal the end of the text row. However, by this time, the dbreadtext also processes the third result set. The next call to dbresults returns NO_MORE_RESULTS.

WORKAROUND

To work around this problem, do either of the following:

  • Make sure the text result is the final result set on the batch.

    -or-

  • Use the dbdata and dbnextrow functions to process the text where possible.

STATUS

Microsoft has confirmed this to be a problem in SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words:
Keywords : kbbug6.50 SSrvProg kbprg
Version : WINDOWS:6.5
Platform : WINDOWS
Issue type : kbbug
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.