INF: Invalid Use of dbwritetext Can Cause 806 Errors
ID: Q139555
|
The information in this article applies to:
-
Microsoft SQL Server versions 4.2x, 6.0, 6.5, 7.0
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 : winnt:4.2x,6.0,6.5,7.0
Platform : winnt
Issue type : kbinfo