Using DAAB with Binary Data

Topics: Data Access Application Block
Apr 13, 2011 at 9:02 PM

Is it possible to use the DAAB to insert and select binary data?  I want to store files (PDF, etc.) in the database.  I can't seem to figure out how to insert new records or select records that contain binary fields using the Data Access Application Block.  There doesn't seem to be any documentation on how to do it.  Is it possible?

Apr 14, 2011 at 1:33 AM
Edited Apr 14, 2011 at 1:34 AM

DAAB is just a wrapper of ADO.NET.  So since this is possible with ADO.NET, you can also do that.  If you're using SQL database, you can make use of a Varbinary(MAX) column and when adding the value for the parameter using DAAB, you just have to make use of DbType.Binary. Example

database.AddInParameter(dbCommand, "FileContent", DbType.Binary, fileContent);

where fileContent is a byte array. 


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.