Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Trouble in updating source in ADO

Trouble in updating source in ADO

Scheduled Pinned Locked Moved Database
databaseannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wicked_guy
    wrote on last edited by
    #1

    Hi everone, I am having trouble in updating the source database. I am using a dialog based application with a datagrid. I managed to add a number (01065017) to the first coloumn succesfully but could not update the source after the addition of this number. Any Idea why. The following is the code: m_pConn.CreateInstance(__uuidof(Connection)); m_pConn->Open("Provider=Microsoft.Jet.OLEDB.4.0;" "Data Source=ADOTestDB.MDB", _bstr_t (""), _bstr_t (""), adModeUnknown ); m_pComm.CreateInstance(__uuidof(Command)); m_pComm->ActiveConnection = m_pConn; m_pComm->CommandText = "Select * From Student"; m_pReco.CreateInstance(__uuidof(Recordset)); m_pReco->CursorLocation = adUseClient; m_pReco->Open ( (IDispatch *) m_pComm, vtMissing, adOpenStatic, adLockBatchOptimistic, adCmdUnknown); m_DataCtrl.SetCaption("Students"); m_DataCtrl.SetRefDataSource(NULL); m_DataCtrl.SetRefDataSource((LPUNKNOWN) m_pReco); m_DataCtrl.Refresh(); m_pReco->AddNew(); FieldsPtr pFields = m_pReco->Fields; FieldPtr pStudentNo = pFields->GetItem("StudentNo"); ASSERT(NULL != pStudentNo); CString ali = (char*)(_bstr_t) pStudentNo->Value; ali.Format("01065017"); _variant_t vColumn, vValue; vColumn.SetString("StudentNo"); vValue.SetString(ali); m_pReco->Update(vColumn, vValue); m_pReco->Update(); Thanx in advance

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups