images from database

  • Thread starter Thread starter cashdeskmac
  • Start date Start date
C

cashdeskmac

Hi,

I have a set of images in a database and I am using a DataReader to retrive
them:

SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{

Byte[] b = (Byte[])dr["img_data"];
MemoryStream ms = new MemoryStream(b);
Image img = Image.FromStream(ms);
//create the html for the span
imageholder.InnerHtml = "";
}

Now that I have the Image, how can I assign it to the InnerHtml of the span
called imageholder (which has the attribute runat="server")?
 
There is no inner html for image. Instead, there is an image source
attribute. You should put your code into a separate GetImage.aspx page that
will have no markup and call it like this:

<img ... src="GetImage.aspx?id=myImageId" />
 
Back
Top