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