About Informix Cursor Usage Method and Code (UNIX)

xiaoxiao2021-03-06  87

In Informix, I have to read all the records in the door, and then put these record values ​​on the screen, how do I achieve it, then we will use the game, below It is a simple code to use the cursor, this is an EC program: #include #include #include #include #include

Main () {exec SQL include SQLCA; / * Defines the communication area * / exec SQL Begin Declare section; / * Main variable definition start * / char * String1; char str1 [10]; char str2 [10]; Exec SQL End Declare Section; / * Main variable definition end * / // exec SQL DROP DATABASE EXAMPLE; EXEC SQL CREATE DATABASE EXAMPLE; EXEC SQL Database EXAMPLE; / * Connection Database * / IF (Sqlcode == 0) {EXEC SQL CREATE TABLE Student (ALARM Char (6), SNAME CHAR (10));} // Insert Data EXEC SQL INSERT INTO Student Values ​​("AAAA", "BBBB"); Exec SQL INSERT INTO Student Values ​​("DDDD", "DDDD"); EXEC SQL INSERT INTO Student Values ​​("CCCC", "CCCC"); // Set the cursor where Declare gives the query result to FET_CUR EXEC SQL DECLARE FET_CUR CURSOR for SEECT ALARM, SNAME from Student; Exec SQL Open FET_CUR; Printf ("Sqlcode =% D / N ", SQLCODE);

转载请注明原文地址:https://www.9cbs.com/read-106911.html

New Post(0)