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 st开发者_JS百科atus */
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);
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.
精彩评论