用C连接MSSQL数据库,用的是MSSQL下的自带例子,为什么会出现SQLFRONT.H文件中有错误?

Jacob_son 2005-03-09 02:30:05
SQL.c文件

#define DBNTWIN32
#include <sqlfront.h>
#include <sqldb.h>

main()
{
DBPROCESS *dbproc;
LOGINREC *login;
RETCODE r;

dbinit();
login = dblogin();
if (login == NULL)
return (1);
DBSETLUSER(login, "my_login");
DBSETLPWD(login, "my_password");
dbproc = dbopen(login, "my_server");
dbfreelogin(login);
if (dbproc == NULL)
return (1);
dbuse(dbproc, "pubs");
dbcmd(dbproc,
"select au_fname from authors where au_lname = 'White'");
r = dbsqlexec(dbproc);
if (r == FAIL)
return (1);
while (1)
{
r = dbresults(dbproc);
if (r == SUCCEED)
{
/* Process the rows with dbnextrow() */
}
if ((r == FAIL) || (r == NO_MORE_RESULTS))
break;
}
return (0);
}

TC编译时老是报Sqlfront.h 文件有错,像 Error C:\TURBOC2\INCLUDE\SQLFRONT.H 87: Declaration syntax error 之类的。而Sqlfront.h 等头文件都是用MSSQL的自带的,这是为什么?
...全文
269 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jacob_son 2005-03-10
  • 打赏
  • 举报
回复
我用的是MSSQL2000没打过补丁的数据库
Jacob_son 2005-03-09
  • 打赏
  • 举报
回复
我用的是TC2的编译器,没有楼上提到的那些选项,Sqlfront.h等我是从MSSQL那拷到TC的include文件夹下的,编译老是通不过,q我在Include directories选项中加了MSSQL的路径也不行,出现这些错误:
Compiling C:\TURBOC2\PROJECT\TESTSQL.C:
Error C:\TURBOC2\INCLUDE\SQLFRONT.H 85: Declaration syntax error
Error C:\TURBOC2\INCLUDE\SQLFRONT.H 168: Declaration syntax error
Error C:\TURBOC2\INCLUDE\SQLFRONT.H 172: Declaration missing ;
Error C:\TURBOC2\INCLUDE\SQLFRONT.H 173: Redeclaration of 'USHORT'
Error C:\TURBOC2\INCLUDE\SQLFRONT.H 173: Declaration missing ;
Error C:\TURBOC2\INCLUDE\SQLFRONT.H 186: Declaration missing ;
Error C:\TURBOC2\INCLUDE\SQLFRONT.H 192: Declaration missing ;
先谢过楼上的这位:)
Dong 2005-03-09
  • 打赏
  • 举报
回复
在:
Tools-->Options-->Directories-->Show Directories for的下拉框选择Include Files
在下面的列表框里添加
#include <sqlfront.h>
#include <sqldb.h>
这两个目录所在的目录!就是MSSQL文件夹里的那些

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧