INF: dbwritetext Sample Code Documentation Incorrect

Last reviewed: April 28, 1997
Article ID: Q95125

The information in this article applies to:
  • Microsoft SQL Server Programmer's Toolkit, version 4.2

SUMMARY

The dbwritetext documentation on page 246 and 247 of the "Programmer's Reference for C" contains incorrect sample code.

MORE INFORMATION

On page 246, replace the last part of the code in the example, from the following lines to the end

   while (dbnextrow(q_dbproc)
       != NO_MORE_ROWS);

to read as follows:

   while (dbnextrow(q_dbproc) != NO_MORE_ROWS)
   {
       /* Change the value of "abstract_var". */
       strcpy(abstract_var, "A brand new value.");
       /* Update the text column. */
       dbwritetext(u_dbproc, "articles.abstract", dbtxptr(q_dbproc, 1),
           DBTXPLEN, dbtxtimestamp(q_dbproc, 1), TRUE,
           (DBINT)strlen(abstract_var), abstract_var);
   }
   /* Done. */
   dbexit();

On page 247, replace the last part of the code in the example, from the following lines to the end

   while (dbnextrow(q_dbproc)
       != NO_MORE_ROWS);

to read as follows:

   while (dbnextrow(q_dbproc) != NO_MORE_ROWS)
   {
       /* Change the value of part of the text column. This example */
       /* adds a sentence to the end of the existing text.*/
       /* Update the text column. */
       dbwritetext(u_dbproc, 'articles.abstract", dbtxptr(q_dbproc, 1),
           DBTXPLEN, dbtxtimestamp(q_dbproc, 1), TRUE,
           (DBINT)(strlen(part1) + strlen(part2)), NULL);
       dbsqlok(u_dbproc);
       dbresults(u_dbproc);
       /* Send the update value in chunks. */
       dbmoretext(u_dbproc, (DBINT)strlen(part1), part1);
       dbmoretext(u_dbproc, (DBINT)strlen(part2), part2);
       dbsqlok(u_dbproc);
       while (dbresults(u_dbproc) != NO_MORE_RESULTS);
   }
   dbexit();


Additional query words: db-lib dblib
Keywords : kbprg SSrvDB_Lib SSrvDoc_Err
Version : 4.2 | 4.2 | 4.2
Platform : MS-DOS OS/2 WINDOWS
Issue type : kbdocerr


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