Error-ODBC static cursors required for snapshot support. 
Author Message
 Error-ODBC static cursors required for snapshot support.

Hello !!

I  am working on VC ++. I am connecting to the database using Intersolv's
driver and client. The database I am referring to is Sybase database .
Presently we are using only the demo version of the sybase driver.  Described below is the exact problem that I am experiencing.

I am having a problem using CRecordset of MFC . I have done the following
Opened database using CDatabase
CDatabase database;
database.OpenEx("DSN=dsn;UID=uid;PWD=pwd");
Instantiated CRecordset recordset(&database);
opening the recordset with following options recordset.Open(CRecordset::snapshot,query);

This gives an exception - ODBC static cursors required for snapshot support.

However the same command  works when I am connecting to an Access database. Given below is the portion of the code where I am attaching to the database.

The piece of code that creates problem. void CMainFrame::OnTest()
{
if( !m_dbCust.IsOpen( ) &&
!m_dbCust.OpenEx( "DSN=tester" ) )
return  ;

m_pRecordSet.Open(&m_dbCust);
m_pRecordSet->SetRowsetSize(20);
CString sqlStatement(_T("SELECT * FROM [table]")); m_pRecordSet->Open(
AFX_DB_USE_DEFAULT_TYPE,
sqlStatement);
CString str;
while(!m_pRecordSet->IsEOF())
{
CDBVariant var;
m_pRecordSet->GetFieldValue(1,var,DEFAULT_FIELD_TYPE); m_pRecordSet->MoveNext();
if(var.m_dwType==DBVT_STRING)
str= *(var.m_pstring);
AfxMessageBox(str);

Quote:
}
}

where m_dbCust is  CDatabase object and m_pRecordSet is CRecordset Object.

Thanking You
Barath.A.L



Mon, 15 Jan 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ODBC cursors required for snapshot support, why?

2. ODBC cursors required for snapshot support, why?

3. Dynaset/Snapshot ODBC problem

4. ODBC snapshot, dynaset problem?

5. ODBC/MFC Cursor Error

6. ODBC Cursor Lib vs Driver Cursor

7. ODBC Error in static link

8. ODBC errors on VC++ startup - ODBC error.jpg (0/1)

9. fatal error C1189: #error : MFC requires C++ compilation (use a .cpp suffix)

10. C# -- Required Runtime Support

11. ODBC API required

12. Please let me know where to find odbc.inf file required by SQLInstallODBC

 

 
Powered by phpBB® Forum Software