Hi,
I'm trying to display an image that's stored in a SQL Server database. The ContentType and binary data are being returned but the image is coming up as a broken image. To test that the data is being retrieved I tried outputting the content type.
Response.Write(adm["Image_MIME_type"].ToString());
It is getting the corect data i.e. "image/pjpeg"
Then I tried Response.write for the binary data returned
Response.Write((byte[])adm["Image_image"]);
It is outputting printing "System.Byte[]"
Am I right in saying the data is being returned from the SPROC?
Here is the code...
if (adm.HasRows)
{
while (adm.Read())
{
// Response.Write(adm["Image_MIME_type"].ToString());
Response.ContentType = adm["Image_MIME_type"].ToString();
Response.BinaryWrite((byte[])adm["Image_image"]);
}
}
else
{
Response.Write("Reaer has no rows");
}
adm.Close();
conn.Close();