weird odbc error

weird odbc error

Post by Philip F. Che » Fri, 23 Apr 1999 04:00:00



Hi,

I have a fairly simple routine which retrieves a single field. But this
routine will fail after being called exactly 160 times !!!

char* getLastName(char* pId)
{

    char* pRetVal = new char(51);
    char Statement[255];
    sprintf(Statement, "SELECT last_name FROM namemaster WHERE id='%'",
pId);

    SQLINTEGER fieldLenOrInd = SQL_NTS;
    SQLBindCol(m_hStmt, 1, SQL_C_CHAR, pRetVal, 51, &fieldLenOrInd);

    SQLRETURN retcode = SQLExecDirect(m_hStmt, (unsigned char*)&Statement,
SQL_NTS);

    retcode = SQLFetch(m_hStmt);

    SQLCloseCursor(m_hStmt);

    return pRetVal;

Quote:}

For simplicity I removed all error handling, etc. It took me two days to
figure out why. But I haven't got any clue.

Please help if you know anything about it. I am using SQL Server 7.0 and
ODBC 3.510.3513.

Thanks a bounch!

Philip

 
 
 

weird odbc error

Post by huge » Sat, 24 Apr 1999 04:00:00


if it fails after 160 times, I would probably look at the data in that
particular field of that particular record.
How does it differ from the previous 159 fields/times it was called?
Have you tried a different source to test against?
How many records are in your set?
Special characters like apostrophes or double quotes or others?

>Hi,

>I have a fairly simple routine which retrieves a single field. But this
>routine will fail after being called exactly 160 times !!!

>char* getLastName(char* pId)
>{

>    char* pRetVal = new char(51);
>    char Statement[255];
>    sprintf(Statement, "SELECT last_name FROM namemaster WHERE id='%'",
>pId);

>    SQLINTEGER fieldLenOrInd = SQL_NTS;
>    SQLBindCol(m_hStmt, 1, SQL_C_CHAR, pRetVal, 51, &fieldLenOrInd);

>    SQLRETURN retcode = SQLExecDirect(m_hStmt, (unsigned char*)&Statement,
>SQL_NTS);

>    retcode = SQLFetch(m_hStmt);

>    SQLCloseCursor(m_hStmt);

>    return pRetVal;
>}

>For simplicity I removed all error handling, etc. It took me two days to
>figure out why. But I haven't got any clue.

>Please help if you know anything about it. I am using SQL Server 7.0 and
>ODBC 3.510.3513.

>Thanks a bounch!

>Philip


 
 
 

1. Weird ODBC error

Has anyone ever seen error number 388221? The message text on the error is
SQL Selected Record is invalid - 00000. This has us baffled, and help would
be appreciated. If it helps, the error is coming from our web servers making
calls to the SQL backend. TIA

Norm
remove the munge to reply by email

2. Have people taken a look at pgdiff yet?

3. Weird ODBC error?

4. DOA with dBase/Foxpro

5. Weird ODBC error with Access95/VB5/SQL Server 6.5

6. VB/Oracle Developer/Systems Engineer II (Job #4962)

7. Weird ODBC error

8. key group locked error, weird TDBEdit focus error

9. Please help me solve this weird ODBC Connection Problem

10. weird ODBC+SQLServer 7.0 problem

11. Help with weird fetch delay from SS7 via ODBC

12. A weird ODBC+SQL Server 7.0 problem