Unable to read binary field type
Database
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I've been googling all day, found info but it still doesn't work I have a binary field of 50 bytes long. I need to load this from the database and store it into a byte array in my application VC++ (NO .NET). But it seems I just can't convert the SafeArray data into a BYTE[]. I'm really stuck on this. I am getting despreratly, this shouldn't be this hard so what don't i see.
... _RecordsetPtr rsFoo; _variant_t vtHolder; int iMyID; BYTE* pMyData = new BYTE[50]; try { rsFoo.CreateInstance(__uuidof(Recordset)); rsFoo->Open((_bstr_t)strQuery, GetConnectionPtr().GetInterfacePtr(), adOpenDynamic,adLockReadOnly, adCmdText); if(rsFoo->adoEOF && rsFoo->BOF) return; vtHolder = rsFoo->GetCollect("ID"); if(vtHolder.vt != NULL) { iMyId = (int)vtHolder; } vtHolder = rsFoo->GetCollect("Data"); if(vtHolder.vt != NULL) { // // i come here, and getting in the watch window // safearray of UI1 = [50](0,0,0,0,0,0,0,0,0,0,0,...) tagSAFEARRAY .... // WHAT TO DO HERE TO PUT THIS INT pMyData .... } } catch...
codito ergo sum