INF: Invalid Use of dbwritetext Can Cause 806 Errors (139555)



The information in this article applies to:

  • Microsoft SQL Server 4.2x
  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 6.5
  • Microsoft SQL Server 7.0
  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q139555

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.


Modification Type:MajorLast Reviewed:12/3/2003
Keywords:kbinfo kbProgramming KB139555