Access violation in CRecordset.Close() 
Author Message
 Access violation in CRecordset.Close()

We get the following e.Exception:

 0x0000005 Access violation in ODBCCR32.DLL
when we attempt to close a recordset (that we
ensure is open).

This is with VC++ V5.0.
It appears that the m_hstmt value is invalid
when the call to SQLFreeStmt is called.

Does anyone know what causes this?
Thanks.
john

void CRecordset::Close()
{
        ASSERT_VALID(this);
.
.
.
.
        RETCODE nRetCode;
        if (m_hstmt != SQL_NULL_HSTMT)
        {
                AFX_SQL_SYNC(::SQLFreeStmt(m_hstmt, SQL_DROP));
                m_hstmt = SQL_NULL_HSTMT;
        }



Mon, 09 Oct 2000 03:00:00 GMT  
 Access violation in CRecordset.Close()

When you open this recordset, by any chance are you passing in a
CDatabase pointer that was initialized by a previous CRecordset (or
any CDatabase pointer pointer for that matter?

Quote:
>Subject: Access violation in CRecordset.Close()
>Date: Thu, 23 Apr 1998 22:17:53 -0400

>We get the following e.Exception:

> 0x0000005 Access violation in ODBCCR32.DLL
>when we attempt to close a recordset (that we
>ensure is open).

>This is with VC++ V5.0.
>It appears that the m_hstmt value is invalid
>when the call to SQLFreeStmt is called.

>Does anyone know what causes this?
>Thanks.
>john

>void CRecordset::Close()
>{
>    ASSERT_VALID(this);
>.
>.
>.
>.
>    RETCODE nRetCode;
>    if (m_hstmt != SQL_NULL_HSTMT)
>    {
>            AFX_SQL_SYNC(::SQLFreeStmt(m_hstmt, SQL_DROP));
>            m_hstmt = SQL_NULL_HSTMT;
>    }

Charles Steinhardt[MVP]


Fri, 13 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Access Violation when calling CRecordset::Requery()

2. NTDLL.DLL Access Violation in CRecordset-derived class?

3. Access violations once OCBC/CRecordset added to console app

4. CRecordset Open Access violation

5. CRecordset - access violations

6. CRecordset access violation

7. CRecordset Access Violation

8. Memory access violation using CRecordset and date/time fields

9. Access Violation when calling CRecordset::Requery()

10. Access violation after HtmlHelp window closed

11. Access violation after HtmlHelp window closed

12. OLE32.DLL Access Violation on close...

 

 
Powered by phpBB® Forum Software