SQLINTEGER 的 ODBC 错误
这个错误是什么意思我已经尝试了所有可能的改变它的方法,但它不起作用。
无法将参数 '6' 的 'SQLINTEGER*' 转换为 'long int*' 到 'SQLRETURN SQLGetData(void*, SQLUSMALLINT, SQLSMALLINT, void*, long int, long int*)' 强调文本
Here is the code
#ifndef CPSC_408_DB_H
#define CPSC_408_DB_H
#include <sql.h>
#include <sqlext.h>
#include <iostream>
#include <string> using namespace std;
class Monster { public:
Monster(string dsn); ~Monster();
void execQuery();
private: //used for connection and status
SQLHENV env;
SQLHDBC dbc;
SQLHSTMT stmt;
SQLRETURN ret; /* ODBC API return status */
SQLCHAR outstr[1024]; SQLSMALLINT outstrlen;
};
#endif
//sql getdata method
/* retrieve column data as a string */
ret = SQLGetData(stmt, i+1, SQL_C_CHAR,
buf, sizeof(buf), &indicator);
What does this error mean I have tried All possible means of changing it but it is not working.
cannot convert ‘SQLINTEGER*’ to ‘long int*’ for argument ‘6’ to ‘SQLRETURN SQLGetData(void*, SQLUSMALLINT, SQLSMALLINT, void*, long int, long int*)’emphasized text
Here is the code
#ifndef CPSC_408_DB_H
#define CPSC_408_DB_H
#include <sql.h>
#include <sqlext.h>
#include <iostream>
#include <string> using namespace std;
class Monster { public:
Monster(string dsn); ~Monster();
void execQuery();
private: //used for connection and status
SQLHENV env;
SQLHDBC dbc;
SQLHSTMT stmt;
SQLRETURN ret; /* ODBC API return status */
SQLCHAR outstr[1024]; SQLSMALLINT outstrlen;
};
#endif
//sql getdata method
/* retrieve column data as a string */
ret = SQLGetData(stmt, i+1, SQL_C_CHAR,
buf, sizeof(buf), &indicator);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您将编译器抱怨的 SQLGetData 的实际调用以及所有相关声明发布出来,将会有所帮助,但我会尝试一下。
SQLGetData 的最后一个参数应该是指向 long int 的指针(有时在某些版本的 ODBC 文档中称为 SDWORD),而不是指向 SQLINTEGER 的指针。检查您要传递地址的变量的类型,并根据需要更新它。
分享并享受。
It would help if you'd post the actual call to SQLGetData that the compiler is griping about, along with all related declarations, but I'll take a stab at it.
The last parameter to SQLGetData is supposed to a pointer to a long int (sometimes referred to as an SDWORD in some versions of the ODBC docs), not a pointer to an SQLINTEGER. Check the type of the variable whose address you're passing and update it as necessary.
Share and enjoy.