I am having trouble using CDaoRecordset::AddNew. Basically I am trying to scan a table for a name. If that name is not there, I want to add it. Here is my code:
strQuery.Format("select ArtistID from Artists where ArtistName = '%s'", pszArtistName);
CDaoRecordset* pRS = new CDaoRecordset(m_pDB);
int iRecords = pRS->GetRecordCount();
catch (CDaoException* e)
The problem is that every time I try to call SetFieldValue I get an exception that says "Item not found in this collection". The new row (blank however) is added to the table, I just can't set my data for that row.
How can I accomplish this?