You could achieve this using custom recordset.
1. Create your own class inherited from CRecordset.
2. Put to public a class members like the following:
public:
LONG a;
CLongBinary b;
CString c;
BOOL d;
3. Assign a number of columns in constructor by defining
m_nFields variable.
4. Implement data exchange between fields of data base with class members by defining DoFieldExchange.
VOID MyRecordset::DoFieldExchange( CFieldExchange *ex ){
ex->SetFieldType(CFieldExchange::outputColumn);
RFX_Long( ex, "db_field_a", this->a );
RFX_LongBinagy( ex, "db_field_b", this->b );
}
5. Open your recordset (as you actually did with CRecordset object) with any query to target table
6. Create a new record with AddNew() method
7. Assign your long binary data member with BYTE array and other members with respective values
8. Update your recordset.
These articles might help:
http://msdn.microsoft.com/en-us/library/s55kt8s3(v=vs.71).aspx[
^]
http://msdn.microsoft.com/en-us/library/yd6x6wbd(v=vs.71).aspx[
^]
http://msdn.microsoft.com/en-us/library/czxt1e3z.aspx[
^]