-
_RecordsetPtr::AddNew()
Hi,
i'm connecting to an access database useing _RecordsetPtr::Open(...), after that, I verify that i can put data on it, useing_RecordsetPtr::Supports(adAddNew) and _RecordsetPtr::Supports(adUpdate), but when i call to the _RecordsetPtr::AddNew() function, it adds a row in the top of the table, but all with black record, and i can't modify it.... anyone knows why it happens???
Thanks in advance,
Diego
-
Any call to the ::AddNew() method will ADD a row to your database. Call AddNew() and then set the database fields with data and lastly call your ::Update() method to write the data to the new record.
The addnew() method should actually be the 2nd LAST call you make to a database, followed by a call to ->Update(), followed by a ->close() call.
I do this ALL the time and the way I do this stuff is to Addnew(), Set the database fields and then call update.
//
//Our table has three fields
//
rsAgenda->AddNew();
rsAgenda->Fields->GetItem("FName")->Value=vt_FirstName;
rsAgenda->Fields->GetItem("LName")->Value=vt_LastName;
rsAgenda->Fields->GetItem("PCode")->Value=vt_Postcode;
rsAgenda->Update();
//Database update complete. Call ->Close() is necessary.
++Roddy