CDaoRecordset: "Item not found in this collection"
Posted on 2001-08-07
I'm going mad! Why do I get this message?
1) I open the recordset with:
m_rsTitle.Open (dbOpenDynaset, "SELECT TitleID, Title FROM Title");
2) Everytime I want to read or write to the set I do:
m_rsTitle.SetFieldValue ("Title", szBuffer);
With each read or write I get "Item not found in this collection" I've tried using SetFieldValue (1, szBuffer) but it gives the same error. The weird thing is that just yesterday it worked for the first record that I add,
but then after that it only gave the error. And it is not just with either GetFieldValue() or SetFieldValue(), but with both.
For each dlg that uses the database I create
and open it in OnInitDlg()
I also declare for each record set
and also open it in OnInitDlg()
I then close these in the destructor method of the class.
May this is the problem? Is it better to open the database and close it in the destructor but open and close the record set in each method?