I've found several good examples of how to display an image from a database, but I'm looking for an example of how to display an image within an aspx page with other controls. This code works fine, but only displays the image by itself on the page (item4 is the image data, stored in SQL Server as type=Image):
Stream strmImage = new MemoryStream(item4.Image_Data.ToArray());
byte buffer = new byte;
int byteSeq = strmImage.Read(buffer, 0, 4096);
while (byteSeq > 0)
Response.OutputStream.Write(buffer, 0, byteSeq);
byteSeq = strmImage.Read(buffer, 0, 4096);
I've also tried to save the data as a System.Drawing.Image, but like using the Response.Outputstream instruction above, it immediately outputs the image and nothing else on the page.
System.Drawing.Image myImage = System.Drawing.Image.FromStream(strmImage);
In simple terms, I want to get the image from the database, stick it in a variable or something like that, then display it in a table. Any suggestions?
View Complete Post