It took me a while to figure this out so I thought I would post the solution here. I needed to get a blob out of the database and assign it to a byte[] in my object
Solution
//initialise the byte[] and get its size
byte[] byteArray = new byte[(dr.GetBytes(dr.GetOrdinal("File"), 0, null, 0, int.MaxValue))];
//Assign bytes to byte array
dr.GetBytes(dr.GetOrdinal("File"), 0, byteArray, 0, byteArray.Length);//Assign Value
file.FileByte = byteArray;
Enjoy
No comments:
Post a Comment