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. multiple rows were updated

multiple rows were updated

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelp
5 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.
  • J Offline
    J Offline
    jafrazee
    wrote on last edited by
    #1

    i get this error if a user deletes a record and that record has a duplicate data in the file. all records are unique though. i do have a time stamp and a userid field that will always create unique records. so the complete record is not duplicated. the table that i am using is a VFP table with no index attached. in my application i have no order set. is there a way to trap this error, ignore and continue. thank you.

    B 1 Reply Last reply
    0
    • J jafrazee

      i get this error if a user deletes a record and that record has a duplicate data in the file. all records are unique though. i do have a time stamp and a userid field that will always create unique records. so the complete record is not duplicated. the table that i am using is a VFP table with no index attached. in my application i have no order set. is there a way to trap this error, ignore and continue. thank you.

      B Offline
      B Offline
      Bill Wilson
      wrote on last edited by
      #2

      Catch a CDBExeption object. If you don't know what I mean, lookup try in MSDN. Good luck, Bill

      J 1 Reply Last reply
      0
      • B Bill Wilson

        Catch a CDBExeption object. If you don't know what I mean, lookup try in MSDN. Good luck, Bill

        J Offline
        J Offline
        jafrazee
        wrote on last edited by
        #3

        i have created a try/catch/throw handler. it allows me to trap the error with my own message and exit my loop. but what i need is a way to prevent the error from happening at all. is this possible? actually i did not mention that i am using a crecordset that is setup as snapshot. this is the only way i could get a VFP database to work.

        B 1 Reply Last reply
        0
        • J jafrazee

          i have created a try/catch/throw handler. it allows me to trap the error with my own message and exit my loop. but what i need is a way to prevent the error from happening at all. is this possible? actually i did not mention that i am using a crecordset that is setup as snapshot. this is the only way i could get a VFP database to work.

          B Offline
          B Offline
          Bill Wilson
          wrote on last edited by
          #4

          What is the actual error condition. Your original post didn't mention it. Are you trying to trap an error or avoid it? The difference definitely effects the answer. Is the problem that the database is actually deleting multiple rows? If so, you can fix the problem(it is not really an error, just a coding mistake) by using more specific criteria in your SQL statements. Good luck, Bill

          J 1 Reply Last reply
          0
          • B Bill Wilson

            What is the actual error condition. Your original post didn't mention it. Are you trying to trap an error or avoid it? The difference definitely effects the answer. Is the problem that the database is actually deleting multiple rows? If so, you can fix the problem(it is not really an error, just a coding mistake) by using more specific criteria in your SQL statements. Good luck, Bill

            J Offline
            J Offline
            jafrazee
            wrote on last edited by
            #5

            i have a list box that allows the user to mark items to be deleted. on exit of the application i check the listbox and delete the records. i have double checked and none of my records are duplicated. but i do have some logs that have duplicate core data(all but 3 fields the same). the error occurs on the delete function. i have tried a try/catch around the delete function and it will trap the error and exit me out of my loop, but that is not what i need. again i do not have a sort set on the records, my list box takes care of and sorting. thank you do{ retval = pCtrl->GetItemState(ckrec,LVIS_STATEIMAGEMASK); if(retval == LVIS_SELECTED && !m_pSet->IsEOF()){ UpdateData(true); m_pSet->SetAbsolutePosition(ckrec+1); DeleteFile(Buffer); m_pSet->Delete(); } ckrec++; }while(ckrec <= pCtrl->GetItemCount());

            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