How to retrieve images from sql database in asp.net using c#.
i want to retrieve the image file from database and then display the image in a tag.
i try this code but it is not working
aspx
<asp:Image ID="Image1" runat="server" ImageUrl="" Height="150px" Width="165px" />
code behind
Byte[] bytes = (Byte[])ds.Tables[0].Rows[0]["image"];
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "image/jpg";
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
How to give link to the ImageUrl=""
of this image???
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…