The csr_disp.c example program demonstrates using a read-only cursor. First, it opens a cursor with a canned query. Then, it processes the results using the standard ct_results while loop. It binds the column values to program variables. Finally, it fetches and displays the rows in the standard ct_fetch while loop.
Following is the canned query:
select au_fname, au_lname, postalcode
from authors
For more information about this program, see the leading comments in the example source file.
This example requires SQL Server version 11.1 or later
(or Adaptive Server), the pubs2 database, and
the authors table.