Visual C++ Developer Center > Visual C++ Forums > Visual C++ General > how can i update newly added record with _RecordSet ?
Ask a questionAsk a question
 

Answerhow can i update newly added record with _RecordSet ?

  • Wednesday, October 28, 2009 9:32 PMa__cnr__ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    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

All Replies