hi all~
struct user {
unsigned int uid;
unsigned int auth;
};
int funct(int idx) {
struct user usr;
SQLINTEGER ret[2];
SQLBindCol(hStmt, 1, SQL_C_ULONG, &usr.uid, 0, &ret[0]);
SQLBindCol(hStmt, 2, SQL_C_ULONG, &usr.auth, 0, &ret[1]);
if(SQLExecDirect(hStmt, (SQLCHAR*)"select uid,auth from my_tbl where idx=12", SQL_NTS) != SQL_SUCCESS) return -1;
if(SQLFetch(hStmt) == SQL_NO_DATA) return 0;
SQLCloseCursor(hStmt);
return 1;
}
sometimes SQLFetch returns SQL_NO_DATA while the my_tbl has a row whose idx is 12.
it causes critical problem in my system.
Though table has a row, why does the SQLFetch returns SQL_NO_DATA

SQLFetch and SQL_NO_DATA
Stuart Robinson
Agree with Warren - this should work.
Could this be a concurrency or identification issue Maybe you have more than one my_tbl but with different owners
You could simply capture a detailed Profiler trace (the IntegerData column usually contains the rowcount of an operation like your select statement) and see what's going on. In addition, try a simple ADO script to see if the same behavior will occur with ADO/OLEDB.
HTH,
Jivko Dobrev - MSFT
--------------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Ashley Lessard