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. General Programming
  3. C / C++ / MFC
  4. how can i connect MsAccess

how can i connect MsAccess

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpc++databasehelp
2 Posts 2 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.
  • S Offline
    S Offline
    sheerprogrammer
    wrote on last edited by
    #1

    hello, i am very new to VC++.Net. i am getting lots of bugs while working with MsAccess Database. Here is my code fragment. i used the Connection object from toolbox. so the connection is ok. i am able to retrieve the data. But i failed to modify (inserting, updating and deleting). DataSet *ds; OleDb::OleDbDataAdapter* adapter=new OleDb::OleDbDataAdapter("select prt_text,cut from spool",oleDbConnection1); oleDbConnection1->Open(); adapter->Fill(ds,"spool"); DataRow *dr=ds->Tables->Item[0]->Rows->get_Item(1); ds->Tables->Item[0]->Rows->Remove(dr); ds->AcceptChanges(); adapter->Update(ds,"spool"); oleDbConnection1->Close(); how do i delete a record, update a record and add a record. plz help me. Thank u in advance. regards, basheer.

    B 1 Reply Last reply
    0
    • S sheerprogrammer

      hello, i am very new to VC++.Net. i am getting lots of bugs while working with MsAccess Database. Here is my code fragment. i used the Connection object from toolbox. so the connection is ok. i am able to retrieve the data. But i failed to modify (inserting, updating and deleting). DataSet *ds; OleDb::OleDbDataAdapter* adapter=new OleDb::OleDbDataAdapter("select prt_text,cut from spool",oleDbConnection1); oleDbConnection1->Open(); adapter->Fill(ds,"spool"); DataRow *dr=ds->Tables->Item[0]->Rows->get_Item(1); ds->Tables->Item[0]->Rows->Remove(dr); ds->AcceptChanges(); adapter->Update(ds,"spool"); oleDbConnection1->Close(); how do i delete a record, update a record and add a record. plz help me. Thank u in advance. regards, basheer.

      B Offline
      B Offline
      Barm
      wrote on last edited by
      #2

      Hi use CDatabase .Open() to open database .ExecuteNonQuery() to execute insert, update, delete statements use CRecordset to execute select statements Hope this helps Thomas

      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