这是我从王珊,萨师煊《数据库系统概论》中摘来的一段代码(P136)。为什么不能运行 15
#include<stdio.h>#include<stdlib.h>EXECSQLINCLUDESQLCA;EXECSQLBEGINDECLARESECTION;CHA...
#include<stdio.h>
#include<stdlib.h>
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
CHAR Sno(5);
CHAR Cno(3);
INT Grade;
EXEC SQL END DECLARE SECTION;
int main(){
EXEC SQL DECLARE C1 CURSOR FOR //定义游标
SELECT Sno,CnO,Grade
FROM SC;
EXEC SQL OPEN C1; //打开游标
for(;;){
EXEC SQL FETCH C1 INTO :Sno,:Cno,:Grade;//推进游标指针并将当前数据放入主变量
if(sqlca.sqlcode!=SUCCESS)
break;
printf("Sno:%s,Grade:%d",:Sno,:Cno,:Grade);
}
EXEC SQL CLOSE C1;//关闭游标
system("PAUSE");
return 0;
} 展开
#include<stdlib.h>
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
CHAR Sno(5);
CHAR Cno(3);
INT Grade;
EXEC SQL END DECLARE SECTION;
int main(){
EXEC SQL DECLARE C1 CURSOR FOR //定义游标
SELECT Sno,CnO,Grade
FROM SC;
EXEC SQL OPEN C1; //打开游标
for(;;){
EXEC SQL FETCH C1 INTO :Sno,:Cno,:Grade;//推进游标指针并将当前数据放入主变量
if(sqlca.sqlcode!=SUCCESS)
break;
printf("Sno:%s,Grade:%d",:Sno,:Cno,:Grade);
}
EXEC SQL CLOSE C1;//关闭游标
system("PAUSE");
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询