Creating an ADO recordset in C++

I need sample code to show me how to build my own ADO recordset in VC++.  So, I need to create a blank recordset, append field names, open the blank recordset without having a live connection, add new values to the fields I created, and then update the recordset.
FantinoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

juansanchezCommented:
#import "c:\archivos de programa\archivos comunes\system\ado\msado15.dll" no_namespace implementation_only rename("EOF", "EndOfFile")      


        _RecordsetPtr pRs;
        _variant_t vNull;
        vNull.vt=VT_ERROR;
        vNull.scode=DISP_E_PARAMNOTFOUND;
      try{
            pRs.CreateInstance(__uuidof( Recordset));
   
            pRs->CursorLocation  =  adUseClient;
          pRs->CursorType      = adOpenStatic;
          pRs->Fields->Append(_T("field1"), adBSTR, sizeof(BSTR), adFldUnspecified);
            pRs->Fields->Append(_T("fieldint2"), adInteger, sizeof(int), adFldUnspecified);
          pRs->Fields->Append(_T("field3"), adBSTR, sizeof(BSTR), adFldUnspecified);

            pRs->Open(vNull, vNull, adOpenDynamic, adLockOptimistic, adCmdUnknown);

            pRs->AddNew();
      
          pRs->Update(_T("field1"), _variant_t((char*)"Value") );
            pRs->Update(_T("fieldint2"), _variant_t((long) 5) );
          pRs->Update(_T("field3"), _variant_t((char*)"Value") );  

            pRs->AddNew();
      
          pRs->Update(_T("field1"), _variant_t((char*)"Value2") );
            pRs->Update(_T("fieldint2"), _variant_t((long) 3) );
          pRs->Update(_T("field3"), _variant_t((char*)"Value2") );            


                       
      
      }
      catch(_com_error &ce ){
           
             char szMsgEvent[256] ;
             sprintf(szMsgEvent,"CreaRecordSet: "
                                   "Description : %s "
                          "Message     : %s "
                          "HResult     : 0x%08x ",
                           (char*) ce.Description(),
                                   (char*) ce.ErrorMessage(), ce.Error());
        }


I hope this help you!!!!

thanks....

JISR
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.