MFC CRecordset Delete gives a debug assertion failed mesage in runtime.
Posted on 2004-11-05
I am writeing a program in Visual C++ (Console based with MFC support) for database. I try to delete recode from the *.mdb file but it gives me a dubeg assertion error during runtime. I can open the record. I tried to debug and found that Assert(FALSE) happens in SetFieldNull(....) function inside dbcore.cpp file. After program fails, I can see the successful deletion in the *.mdb file. Can anyone help me to solve this debug Assert message.
Here is the code that I wrote in MFC/Visual C++.
CString strConnection = _T("Driver=Microsoft Access Driver (*.mdb);"
rs.Open(CRecordset::dynaset,_T("SELECT * FROM Table1")); //, CRecordset::none);
if(rs.IsEOF() || !rs.CanUpdate() || !rs.CanTransact())
short nFields = rs.GetODBCFieldCount();
for(short index = 0; index < nFields; index++)