INF: Invalid Use of dbwritetext Can Cause 806 Errors

Last reviewed: May 2, 1997
Article ID: Q139555

The information in this article applies to:
  • Microsoft SQL Server, version 4.21a

SUMMARY

Attempting to use a single DBPROCESS to read data and perform a dbwritetext call can generate 806 errors.

MORE INFORMATION

As shown in the SQL Server "Programmers Reference for C," two DBPROCESS structures are used to perform a valid dbwritetext operation.

Some incorrect interpretations of the sample are to use one DBPROCESS. To accomplish this, the dbtxttimestamp and dxtxtptr functions are called immediately after the dbnextrow call and stored in local DBBINARY variables. However, the dbtxtptr only returns a pointer to the result set. In order to perform the dbwritetext operation without results pending on the single connection, you must finish processing all rows with dbnextrow or dbcancel calls. When the dbnextrow or dbcancel function is called, it accordingly clears the result set space, thus invalidating the dbtxtptr you stored in the memory variable.

When the call to dbwritetext is made with an invalid dbtxtptr value error #806 can be generated. The use of a single process is dangerous.


Additional query words: windows nt function
Keywords : kbprg SSrvProg
Version : 4.21a
Platform : WINDOWS


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