Microsoft KB Archive/95125

{|
 * width="100%"|

INF: dbwritetext Sample Code Documentation Incorrect

 * }

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 &quot;Programmer's Reference for C&quot; 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 &quot;abstract_var&quot;. */       strcpy(abstract_var, &quot;A brand new value.&quot;); /* Update the text column. */       dbwritetext(u_dbproc, &quot;articles.abstract&quot;, 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&quot;, 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 : kbprogramming

Issue type :

Technology : kbSQLServSearch kbAudDeveloper kbSQLServPTK420