用vc编译proc报错

chenwg168 chenwg168 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
程序如下:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlca.h>
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR username[20];
VARCHAR password[20];
VARCHAR server[20];
EXEC SQL END DECLARE SECTION;
void sqlerror();
main(){
strcpy((char *)username.arr,"scott");
strcpy((char *)password.arr,"tiger");
strcpy((char *)server.arr,"crmdb");
password.len=strlen(password.arr);
username.len=strlen(username.arr);
server.len=strlen(server.arr);
EXEC SQL WHENEVER SQLERROR DO sqlerror();
EXEC SQL CONNECT :username IDENTIFIED BY :password USING :server;
printf("ok\n");
exit(0);
}
void sqlerror()
{
printf("sql connection error!\n");
exit(1);
}
错误信息如下:
-------------------Configuration: Exam01 - Win32 Debug--------------------
Compiling...
test.c
E:\test\pctest\Exam01\test.c(173) : error C2065: 'sqlca' : undeclared identifier
E:\test\pctest\Exam01\test.c(210) : error C2224: left of '.sqlcode' must have struct/union type
Error executing cl.exe.

Exam01.exe - 2 error(s), 0 warning(s)
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
chenwg168
数据库 4,017 成员 39,805 内容