How to Retrieve a Binary Column

Sep 19, 2012 at 4:06 PM
Edited Sep 19, 2012 at 4:44 PM

I use the following to set the binary column

 How do I  Retrieve a binary column (images, forms, etc)? I can't seem to find a RetrieveColumnAsBinary method.

Api.SetColumn(DBSession, TableID, ID_DataValue, BinaryDataValue);

 

Do I use

 (Byte[])Api.JetRetrieveColumn(...)

How, what parameters do I use?  Do I cast it to Byte[] ?

Thank you

Kamran

 

 

 

 

Developer
Sep 19, 2012 at 5:24 PM

You can either use Api.JetRetrieveColumn(), and pass in a previously-allocated byte array. This can be more efficient if you're doing multiple calls and you can structure your code in such a way as to avoid allocating multiple byte arrays.

Or you can use Api.RetrieveColumn(), which allocates the byte array for you, and returns the result. This one is easier to use, but due to the memory allocations it could end up being slower.

If you allocate a new byte array every time, then I don't think it will make a difference which one you use.

-martin

Sep 19, 2012 at 5:40 PM

I will try this and post the result for others that may ask the same question.

Thanks a bunch

Kamran