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. CRecordSet - odd behaviour with image data fields

CRecordSet - odd behaviour with image data fields

Scheduled Pinned Locked Moved C / C++ / MFC
databasedebuggingquestion
4 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
    neilsolent
    wrote on last edited by
    #1

    Hi Everyone I am using CRecordSet to read data from a SQL database. For an image column, it retrieves the data correctly the first time I try. When the image data is changed in the database, the next query pulls back a string of zeroes instead of the actual data in the database. I am using a CLongBinary member in my derived class to represent the image data, and RFX_LongBinary() to exchange the data. I have even tried deleting and recreating the CRecordSet object, and I STILL get the same behaviour! Anyone seen this / got any ideas how I can debug it?

    cheers, Neil

    D 1 Reply Last reply
    0
    • N neilsolent

      Hi Everyone I am using CRecordSet to read data from a SQL database. For an image column, it retrieves the data correctly the first time I try. When the image data is changed in the database, the next query pulls back a string of zeroes instead of the actual data in the database. I am using a CLongBinary member in my derived class to represent the image data, and RFX_LongBinary() to exchange the data. I have even tried deleting and recreating the CRecordSet object, and I STILL get the same behaviour! Anyone seen this / got any ideas how I can debug it?

      cheers, Neil

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      This is just a wild guess, but could the changed record/column be getting cached? In other words, if you are making the change in SQL and then immediately running your program to grab the updated column, could it be that SQL has cached your change(s)?


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      N 2 Replies Last reply
      0
      • D David Crow

        This is just a wild guess, but could the changed record/column be getting cached? In other words, if you are making the change in SQL and then immediately running your program to grab the updated column, could it be that SQL has cached your change(s)?


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        N Offline
        N Offline
        neilsolent
        wrote on last edited by
        #3

        Thanks for your input. Possibly could be caused by something like that. I have run an isql statement and independently verified that the correct data is returned. So it would have to be caching within that database session. I'll try coding in dropping and recreating the connection, but it's obviously a terrible idea performance-wise. Also, why would it return all zeroes? I would have thought you would just get the old copy of the image returned if caching was going on.. I don't have many ideas how I can effectively debug this.

        cheers, Neil

        1 Reply Last reply
        0
        • D David Crow

          This is just a wild guess, but could the changed record/column be getting cached? In other words, if you are making the change in SQL and then immediately running your program to grab the updated column, could it be that SQL has cached your change(s)?


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          N Offline
          N Offline
          neilsolent
          wrote on last edited by
          #4

          Further testing has revealed that the image data column is always corrupted (set to all zeroes) for the first row returned when Open() or Requery() is run against the CRecordset-derived class.. not sure what is different about this first row..

          cheers, Neil

          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