SQLFetch And SQL_NO_DATA

Dec 28, 2006

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??



View 2 Replies


ADVERTISEMENT

SQL_NO_DATA When Fetching

May 6, 2008

Hi all,

While I was testing our application installation on Vista, I ran across this problem:

When a program on Vista is executing a SPROC is a SQL Server on Vista (actually same machine), the SQLFetch(m_hstmt) returns a SQL_NO_DATA.

When the exact same program is executed on XP SP2 client against the same Vista based SQL Server, it correctly returns the rows.

The build of the program was done on a MDAC 2.8 XP SP2. When I tried to install 2.8 on Vista machine it seemed to have failed.

Using DSN vs. DSNless connection string made no difference. Nothing of intest in SQL Logs either.

Any clues?

View 3 Replies View Related

ODBC SQLFetch Problem

Aug 23, 2006

Hi,

I have ODBC code reading data from a XLS file.

It opens the file, reads the sheets and columns available, then presents a dialog to allow the user to select which columns are to be used to load the data.

All of this works, almost.

It is a simple "Select A,B,C FROM Sheet1" using SQLExecDirect

When using SQLFetch it always skips the first row of data.

Thanks, any ideas would be great.

Keith







View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved