出错了!!!
// lxc.cpp : Defines the entry point for the console application.#include <stdio.h>
#include <stdlib.h>
EXEC SQL INCLUDE SQLCA; /*注意:不是SQLCA.H */
/*定义SQL通信区,大小写有别,文件名SQLCA.H是大写的*/
/*SQLCA.H在C:\Program Files\Microsoft SQL Server\devtools\include中*/
int main()
{
EXEC SQL BEGIN DECLARE SECTION; /*主变量说明开始*/
char HSno[10];
char HSname[12];
char HSsex[4];
EXEC SQL END DECLARE SECTION; /*主变量说明结束*/
int count=0;
EXEC SQL CONNECT TO DELL-WJ.recrt USER sa.sa;
if (sqlca->sqlcode==0)
{
printf("\n%s\n","Connect to recrt Success.");
}
else
{
printf("\n%s\n","Connect to recrt Failed.");
return(1);
}
EXEC SQL use recrt;
EXEC SQL DECLARE SX CURSOR FOR
SELECT Sno,Sname,Ssex FROM Student WHERE Sdept='CS';
EXEC SQL OPEN SX;
do {
EXEC SQL fetch SX into :HSno,:HSname,:HSsex;
if (sqlca->sqlcode !=0)
break;
if(count++==0) /*先打出行头*/
printf("%16s,%12s,%10s \n","Sno","Sname","Ssex");
printf("%16s,%12s,%10s \n",HSno,HSname,HSsex);
/*打印查询结果*/
}while(1);
EXEC SQL CLOSE SX; /*关闭游标SX不再和查询结果对应*/
EXEC SQL DEALLOCATE SX; /*释放游标*/
EXEC SQL DISCONNECT all; /*断开所有数据库连接*/
return 0;
}
--------------------Configuration: lxc - Win32 Debug--------------------
Compiling...
lxc.cpp
e:\新建文件夹lxc\c语言\lxc\lxc.cpp(45) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.
lxc.exe - 1 error(s), 0 warning(s)
是什么错误啊!