ADO AddNew gets no error but does not add
I am using ADO and can read the recordset from beginning to end. When I get to the end I am trying to add records but they do not get added. I am using a SQL Select with adOpenDynamic for CursorType when opening the table. After opening the following are both true:
Code:
m_Recordset->Supports(ADODB::adUpdate)
m_Recordset->Supports(ADODB::adAddNew)
The following is a simplified version of what I am using to do the AddNew:
Code:
class CDataRecordset : public CADORecordBinding {
BEGIN_ADO_BINDING(CDataRecordset)
ADO_VARIABLE_LENGTH_ENTRY2(1, ADODB::adVarChar, m_DataKey,
sizeof(m_DataKey), m_DataKeyStatus, TRUE)
END_ADO_BINDING()
public:
CHAR m_DataKey[10];
ULONG m_DataKeyStatus;
};
HRESULT hr=S_OK;
strcpy(m_DataRecordset.m_DataKey, DataKey);
m_DataRecordset.m_DataKeyStatus = 0;
try {
TESTHR(hr = m_Recordset->AddNew());
TESTHR(hr = m_Recordset->Update());
}
catch(_com_error err) {
// Show error
}
catch(...) {
// Show error
}
The EditMode is 0 before the AddNew, 2 after the AddNew and 0 again after the Update. There are no errors but thare are also no records added. Is there anything more I need to do to get the records added?