HELP!ODBC API call SQLFetchScroll returns Access violation with ODBCCR32.dll 
Author Message
 HELP!ODBC API call SQLFetchScroll returns Access violation with ODBCCR32.dll

I have no idea why I have access violation with the ODBC Cursor DLL.
Enclosed is the code.  Can someone help me figure this out.
----
----
----
 SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);

 SQLSetEnvAttr(henv,SQL_ATTR_ODBC_VERSION,
  (SQLPOINTER)SQL_OV_ODBC3,SQL_IS_UINTEGER);

 SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);

 SQLSetConnectAttr(hdbc, SQL_ATTR_ODBC_CURSORS,
SQL_CUR_USE_ODBC,SQL_IS_UINTEGER);

 SQLDriverConnect(hdbc,NULL,ConnectString,sizeof(ConnectString),
  BrowseResult,MAXBUFLEN,&StringLength2Ptr,SQL_DRIVER_NOPROMPT);

 SQLSetConnectAttr(hdbc,SQL_ATTR_AUTOCOMMIT,
  (SQLPOINTER)SQL_AUTOCOMMIT_ON,NameLength1Ptr);

 SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);

 SQLSetStmtAttr(hstmt, SQL_ATTR_CONCURRENCY, SQL_CONCUR_VALUES, 0);
 SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_STATIC, 0);
    SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_ARRAY_SIZE, 200, 0);
    SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_BIND_TYPE, sizeof(INVStruct), 0);

 successtrans = SQLBindCol(hstmt, 1, SQL_C_CHAR,
&Invoices[0].ordnum,sizeof(Invoices[0].ordnum), &Invoices[0].ordnumlen);

 successtrans = SQLBindCol(hstmt, 2, SQL_C_CHAR,
&Invoices[0].shtinv,sizeof(Invoices[0].shtinv), &Invoices[0].shtinvlen);

 successtrans = SQLBindCol(hstmt, 3, SQL_C_CHAR,
&Invoices[0].shiptype,sizeof(Invoices[0].shiptype),
&Invoices[0].stypelen);
 successtrans = SQLBindCol(hstmt, 4, SQL_C_CHAR,
&Invoices[0].shipzip,sizeof(Invoices[0].shipzip), &Invoices[0].sziplen);

 successtrans = SQLBindCol(hstmt, 5, SQL_C_CHAR,
&Invoices[0].curdate,sizeof(Invoices[0].curdate), &Invoices[0].datelen);

 successtrans = SQLBindCol(hstmt, 6, SQL_C_CHAR,
&Invoices[0].ordsts,sizeof(Invoices[0].ordsts), &Invoices[0].ordstslen);

 successtrans = SQLBindCol(hstmt, 7, SQL_C_FLOAT,
&Invoices[0].shipwght,0, &Invoices[0].wgthind);
 successtrans = SQLBindCol(hstmt, 8, SQL_C_CHAR,
&Invoices[0].cartonid,sizeof(Invoices[0].cartonid),
&Invoices[0].cartidlen);

 SQLExecDirect(hstmt,StatementText2,SQL_NTS);

 SQLNumResultCols(hstmt,&colcnt);

  successtrans = SQLFetchScroll(hstmt,SQL_FETCH_NEXT,0); //Access
Violation is raised here.
  if (successtrans == SQL_ERROR)
  {
   ProcessLogMessages(SQL_HANDLE_STMT,hstmt,"\nSQLFetch
failed.\n\n",FALSE);
  }

  if (successtrans == SQL_INVALID_HANDLE)
  {
   ProcessLogMessages(SQL_HANDLE_STMT,hstmt,"\nSQLFetch handle is
invalid.\n\n",FALSE);
  }

  if (successtrans == SQL_NO_DATA)
  {
   ProcessLogMessages(SQL_HANDLE_STMT,hstmt,"\nSQLFetch has no
data.\n\n",FALSE);
  }

  if (successtrans == SQL_STILL_EXECUTING)
  {
   ProcessLogMessages(SQL_HANDLE_STMT,hstmt,"\nSQLFetch still
executing.\n\n",FALSE);
  }



Fri, 09 May 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. HELP: Spurious ODBCCR32.DLL access violation !!!!!!!!!

2. Unhandled exception in... (ODBCCR32.DLL): 0x0000005: access violation

3. HELP!!!! SQLDriverConnect ODBC API Access Violations

4. [Fwd: HELP!!!! SQLDriverConnect ODBC API Access Violations ]

5. Access Violation calling API BuildCommDCB w/VC6 (worked w/VC5)

6. Help: Return from function giving access violation!

7. Help: Return from function giving access violation!

8. Help, ODBCRR32.DLL 0xC000005 Access Violation

9. HELP! Access violation in OLEAUT32.DLL

10. Help! - msdev causes access violation in devshl.dll

11. PostMessage from DLL causes access violations, help please

12. Help: Crash when loading MFC 4.2 dll's in VC6 app (Access violation)

 

 
Powered by phpBB® Forum Software