I am trying to display an image which is fetched from the database as a binary stream, on the web form. Can you shed some light on this!
I am working on a project where users have profiles, and every user have their own profile picture displayed in the home page. THis picture comes from the database.
here is the code i have used to get the stream !
TestDBDataContext context1 = new TestDBDataContext();
var r = (from a in context1.ImageTables where a.Id == 8 select a).First();
MemoryStream stream = new MemoryStream(r.FileImage.ToArray());
thanks
What I’ve done in the past is set the image url to an aspx page, like so:
Then, in the code-behind for getLogo.aspx, I’ve done the following:
Where
imageDatais your image as a byte array