C Examples: DbiGetBlob

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

C Examples: DbiGetBlob

Return to chapter overview

Display the specified field's memo:

The field specified in uFldNum must be a valid memo blob. This example uses the following input:
         fBlobExample1(hCur, pRecBuf, 7);

DBIResult fBlobExample1 (hDBICur hTmpCur, pBYTE pTmpRecBuf, UINT16 uFldNum)

{

   DBIResult rslt;

   char      *BlobInfo;  // Holds Blob information

   UINT32    BlobSize; // Input / Output Blob size in Bytes

 

   rslt = Chk(DbiOpenBlob(hTmpCur, pTmpRecBuf, uFldNum, dbiREADONLY));

   if (rslt != DBIERR_NONE)

      return rslt;

 

   rslt = Chk(DbiGetBlobSize(hTmpCur, pTmpRecBuf, uFldNum, &BlobSize));

   if (rslt != DBIERR_NONE)

      return rslt;

 

   BlobInfo = (char *)malloc(BlobSize * sizeof(BYTE));

 

   rslt = Chk(DbiGetBlob(hTmpCur, pTmpRecBuf, uFldNum, 0, BlobSize,

                     (pBYTE)BlobInfo, &BlobSize));

   if (rslt == DBIERR_NONE)

      MessageBox(0, BlobInfo, "This is the Blob Information", MB_OK);

 

   free(BlobInfo);

 

   rslt = Chk(DbiFreeBlob(hTmpCur, pTmpRecBuf, uFldNum));

 

   return rslt;

}