Я нашел этот пример:
while(!rst->EndOfFile)
{
int shotid = rst->Fields->Item["shot_id"]->Value;
int shotPoint = rst->Fields->Item["shot_num"]->Value;
int length = rst->Fields->Item["length"]->Value;
--- I initialized tha variant and copied the variant into local memory. After that I accessed the SafeArray.
VariantInit(&varBlob);
//varBlob = rst->Fields->Item["data"]->GetChunk((long) MAX_HYDRO_SIZE);
varBlob = rst->Fields->Item["data"]->GetValue();
unsigned char* pData;
unsigned char data[MAX_HYDRO_SIZE];
int blobLength;
if (varBlob.vt == (VT_ARRAY | VT_UI1))
{
SafeArrayAccessData(varBlob.parray,(void **) &pData);
blobLength = varBlob.parray->rgsabound[0].cElements;
TRACE(" length %d : blobLength %d \n",length*4, blobLength);
if (length*4 > blobLength)
AfxMessageBox("Blob Short of Data");
memcpy(&data,pData,blobLength);
SafeArrayUnaccessData(varBlob.parray);
}
else
AfxMessageBox("BLOB returned wrong type");
на http://www.experts -exchange.com / Microsoft / Development / MS-SQL-Server / Q_21296032.html