CRecordset : Debug Assertion Failures with edit/update/addnew
-
Hi I use odbc-access driver in c++ and have a crecordset, created with the adress of a database. I can use my CRecordset-pointer m_pRS to navigate through the set, but whenever i want to edit, update, add or delete something from the recordset (like m_pRS->Edit(); ) i get a debug assertion failure (visual c++ 6.00) Here is the initializing code for the recordset:
// neu initialisieren mit aktueller Datenbank CRecordset *rs = new CRecordset(&m_DB); m_pRS = rs; m_hStmt = m_pRS->m_hstmt;; SDWORD b1; SDWORD b2; SQLBindCol (m_hStmt, 1, SQL_C_CHAR, (PTR)m_mAkt.m_sName, sizeof(m_mAkt.m_sName), &b1); SQLBindCol (m_hStmt, 2, SQL_C_DOUBLE, (PTR)&m_mAkt.m_fDichte, sizeof(m_mAkt.m_fDichte), &b2); SQLBindCol (m_hStmt, 3, SQL_C_CHAR, (PTR)m_mAkt.m_sBeschreibung, sizeof(m_mAkt.m_sBeschreibung), &b1); try { m_pRS->Open( CRecordset::snapshot, _T("SELECT * FROM Material ORDER BY Materialname, Dichte"), CRecordset::none); // Recordset durchzaehlen GetMaterialNum(); } catch ( CDBException *pDBE) { AfxMessageBox("Database Fehler: "+pDBE->m_strError); return false; }
Can someone help me why navigating (calling for example m_pRS.MoveNext(); )works, but not .Edit() , .Update(), .AddNew and so on? Thank you niklas