I recently upgraded from C++ Builder 6 to C++ Builder 2007 and after a few alterations in the code I managed to build my project.
Everything seemed ok until I tried to read from my database. Numbers and texts are ok but not the binary data in the PM field. Here's how I do it:
* I use TADODatasets. I wrote my binaries to the PM-field using:
TStream *stream = TemplateDataSet->CreateBlobStream(adoDataSet->FieldByName("BinaryField"), bmWrite);
* When reading from the database I use TADODataset again together with TField and TStream like this:
TField *templateField = adoDataSet->Fields->FieldByName("BinaryField");
TStream *stream = dbDataSet->CreateBlobStream(templateField, bmRead);
stream->ReadBuffer(numberOfData,sizeof(numberOfData)); //Reads 4 bytes ok
unsigned char dataType;
pStream->ReadBuffer(dataType,sizeof(dataType)); //Fails to read 1 byte but no exception occur.
I should mention that a similar error occured when I earlier this year upgraded my Builder 6 with patches from the website. But then a EReadError occured.
Does anyone know what could be wrong? Maybe you need some more info from me - please let me know if that's the case. I guess (or hope) this must have happened for other people before me. I haven't found anything on this when searching the net and newsgroups though.