The uni_csr_disp.c example program demonstrates using a read-only cursor. It opens a cursor with a canned query. It processes the results using the standard ct_results while loop. It binds the column values to program variables. Then, 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 sample program, see the leading comments in the example source file.
This sample requires a SQL Server version 10.0 or later,
and the pubs2 database.