Using CLongBinary objects for retrieving BLOB from database
I'm using Visual C++ 5.0.
I wrote a small MFC program for retrieving WAV files from a FoxPro database
(Visual FoxPro 5.0). For this I use MFC's ODBC classes. When creating a
recordset for retrieving data from the database which contains the WAV files
ClassWizard automatically selects a CLongBinary type as a container for the
retrieved WAV data. But somehow the CRecordset::Open() isn't executed
without errors. When the record it tries to fetch contains no WAV data at
all, MFC generates this exception: "Error in assignment". Just as if the
CRecordset::Open() doesn't know what to do with an empty record (WAV) field.
When the record being fetched contains WAV data, MFC generates this
exception: "Data truncated". The wave files stored in the database however
are all smaller than 40 kB, while a CLongBinary is used to store Binary
LARGE Objects (BLOBs). I suppose the 16 kB file where MFC generated "Data
truncated" for, can't be considered as being large nowadays, can it?
This is how my CRecordset::Open() looks like:
user_id,name,mailbox,msg_welcome from main"),CRecordset::readOnly)
msg_welcome is a wavefile which gets assigned to a CLongBinary m_msg_welcome
Does anyone have any idea what the problem might be?
Little is better than nothing (in about 50% of all cases).