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. Simple databse problem

Simple databse problem

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelpquestionc++sql-server
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
    Scozturk
    wrote on last edited by
    #1

    Hi! I have a mdb file created by Access 2002 and I am using ado. (and no mfc) pSet is my recordet pointer. I connect and open the database like this: try{ CREATEiNSTANCE(pDb,Connection); pDb->ConnectionString = L"driver={sql server};SERVER=(local);Database=pubs;" L"UID=sa; PWD=;"; pDb->ConnectionString = constr; pDb->Open( "", "", "", -1 ); CREATEiNSTANCE(pSet,Recordset) pSet->PutRefActiveConnection( pDb ); pSet->Open("SELECT TEST1 FROM TABLE1", constr, adOpenDynamic, adLockBatchOptimistic, -1); pSet->MoveFirst(); } catch(_com_error &e) { ...... } This works fine until I call MoveLast or MovePrevious. When I call these it gives an abnormal program termination error. On the net I found some information about it and it tells me that MovePrevious and MoveLast will generate and error if there is no support for bookmarks or no support for backward cursors... I think I managed to integrate backward cursors by specifying adOpenDynamic ( right???). How can I integrate bookmarks or check if my database supports bookmarks? :confused: Thank you very much for your future answers! Well... I am a beginner ...

    L 1 Reply Last reply
    0
    • S Scozturk

      Hi! I have a mdb file created by Access 2002 and I am using ado. (and no mfc) pSet is my recordet pointer. I connect and open the database like this: try{ CREATEiNSTANCE(pDb,Connection); pDb->ConnectionString = L"driver={sql server};SERVER=(local);Database=pubs;" L"UID=sa; PWD=;"; pDb->ConnectionString = constr; pDb->Open( "", "", "", -1 ); CREATEiNSTANCE(pSet,Recordset) pSet->PutRefActiveConnection( pDb ); pSet->Open("SELECT TEST1 FROM TABLE1", constr, adOpenDynamic, adLockBatchOptimistic, -1); pSet->MoveFirst(); } catch(_com_error &e) { ...... } This works fine until I call MoveLast or MovePrevious. When I call these it gives an abnormal program termination error. On the net I found some information about it and it tells me that MovePrevious and MoveLast will generate and error if there is no support for bookmarks or no support for backward cursors... I think I managed to integrate backward cursors by specifying adOpenDynamic ( right???). How can I integrate bookmarks or check if my database supports bookmarks? :confused: Thank you very much for your future answers! Well... I am a beginner ...

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I use this set of C++ wrapper classes for use with ADO. I use these and I must say they work great! So give em a try... http://www.codeproject.com/database/caaadoclass1.asp

      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