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. reading and writing raw data to an access database from c++

reading and writing raw data to an access database from c++

Scheduled Pinned Locked Moved C / C++ / MFC
questiondatabasec++comgraphics
2 Posts 2 Posters 1 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.
  • G Offline
    G Offline
    Gilfrog
    wrote on last edited by
    #1

    What is the correct way to read and write raw data to and from an access database from c++. The field is a Ole Object in the database. The table has two fields in it 1) type -- long 2) data -- Ole Variant CDaoDatabase db; CDaoRecordset recset(&db); db.Open("data.mdb"); recset.Open(AFX_DAO_USE_DEFAULT_TYPE, "SELECT * FROM Main" ,NULL); recset.AddNew(); recset.SetFieldValue("Type", (long)1); BYTE* pInfo; pInfo = new BYTE [30]; for(int i = 0; i < 30; i++) pInfo[i] = i; recset.Update(); recset.Close(); db.Close(); How do i get the data from pInfo into the the field "data" in the database? this data could be anything from a bitmap to text. thanks

    P 1 Reply Last reply
    0
    • G Gilfrog

      What is the correct way to read and write raw data to and from an access database from c++. The field is a Ole Object in the database. The table has two fields in it 1) type -- long 2) data -- Ole Variant CDaoDatabase db; CDaoRecordset recset(&db); db.Open("data.mdb"); recset.Open(AFX_DAO_USE_DEFAULT_TYPE, "SELECT * FROM Main" ,NULL); recset.AddNew(); recset.SetFieldValue("Type", (long)1); BYTE* pInfo; pInfo = new BYTE [30]; for(int i = 0; i < 30; i++) pInfo[i] = i; recset.Update(); recset.Close(); db.Close(); How do i get the data from pInfo into the the field "data" in the database? this data could be anything from a bitmap to text. thanks

      P Offline
      P Offline
      Prem Kumar
      wrote on last edited by
      #2

      Use void SetFieldValue( LPCTSTR lpszName, const COleVariant& varValue ); 1. Put the byte array into a safearray of type VT_U1 2. Embed the array in a variant 3. Pass it to the above function

      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