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. Help with recordsets: How to get the value of a primary key?

Help with recordsets: How to get the value of a primary key?

Scheduled Pinned Locked Moved C / C++ / MFC
csharphelpdatabasevisual-studiotutorial
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.
  • N Offline
    N Offline
    nde_plume
    wrote on last edited by
    #1

    I have been struggling with several things in Visual Studio .Net when I upgraded from version 6.0 One thing I have had lots of problems with is the elimination of support for DaoRecordsets. I have an Access database that I want to access, and I am struggling to do it through ODBC. However, one problem I have had that I cannot seem to get past is trying to get the value of a primary auto number key out of a newly added record. With DAO there were a couple of ways to do it: rs.SetBookmark(rs.GetLastModifiedBookmark()); updates the appropriate field in the recordset. Or alternatively, using GetFieldValue which forced the field to be read from the database. CRecordset does not have a GetLastModifiedBookmark function, and when I call GetFieldValue it throws an exception. I've tried various other strategies, but can't seem to find anything that works. Any help would be much appreciated.

    N 1 Reply Last reply
    0
    • N nde_plume

      I have been struggling with several things in Visual Studio .Net when I upgraded from version 6.0 One thing I have had lots of problems with is the elimination of support for DaoRecordsets. I have an Access database that I want to access, and I am struggling to do it through ODBC. However, one problem I have had that I cannot seem to get past is trying to get the value of a primary auto number key out of a newly added record. With DAO there were a couple of ways to do it: rs.SetBookmark(rs.GetLastModifiedBookmark()); updates the appropriate field in the recordset. Or alternatively, using GetFieldValue which forced the field to be read from the database. CRecordset does not have a GetLastModifiedBookmark function, and when I call GetFieldValue it throws an exception. I've tried various other strategies, but can't seem to find anything that works. Any help would be much appreciated.

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      See this: http://www.codeproject.com/script/comments/forums.asp?forumid=1725&tid=310362&app=50&select=310377#xx310377xx[^] Nick Parker
      The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill


      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