Visual C++ Developer Center >
Visual C++ Forums
>
Visual C++ General
>
how can i update newly added record with _RecordSet ?
how can i update newly added record with _RecordSet ?
- Hi
i had a problem with _Recordset. there is a _Recordset object like opened as_RecordsetPtr m_ptrDataSource;<br/> m_ptrDataSource.CreateInstance(__uuidof(Recordset));<br/> m_ptrDataSource->put_CursorType(adOpenDynamic);<br/> m_ptrDataSource->put_CursorLocation(adUseClient);<br/> <br/> HRESULT hr = m_ptrDataSource->Open(COleVariant(_bstr_t(csQuery)), vtConnection, adOpenDynamic, adLockOptimistic, adCmdText);
then i read all records from the recordset and load them into a listctrl. while i am reading records, i get the bookmark info of the each record and set the bookmark info to listctrl items as item data. when there is a change on listctrl, i can update the current record by bookmark info. that works fine.
but when i add new record, i cant update the record newly added.
is there any way to do this easly?
but i dont want to load all listcrl items. i think that it costs much for time when there are lots records in the recordset.
Answers
- Marked As Answer byWesley YaoMSFT, ModeratorThursday, November 05, 2009 2:44 AM
Hi,
You want to update the recordset or the listctrl? if it's the recordset, just calling AddNew() and then Update() to refresh the recordset.
Regards,
Wesley
Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byWesley YaoMSFT, ModeratorThursday, November 05, 2009 2:45 AM
All Replies
- Marked As Answer byWesley YaoMSFT, ModeratorThursday, November 05, 2009 2:44 AM
Hi,
You want to update the recordset or the listctrl? if it's the recordset, just calling AddNew() and then Update() to refresh the recordset.
Regards,
Wesley
Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byWesley YaoMSFT, ModeratorThursday, November 05, 2009 2:45 AM
Hello,
How are you? Is your problem resolved? May I know whether the above suggestions helped you?
Thanks,
Wesley
Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


