/ Published in: C#

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
protected void Page_Load(object sender, EventArgs e) { string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["ProductCatalogueConnectionString"].ConnectionString; string blobId = Request.QueryString["ID"]; if (!string.IsNullOrEmpty(blobId)) { string cmdText = "select A.blob from Core.Attachment A where A.AttachmentID = '" + blobId + "'"; conn.Open(); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (reader.Read()) { byte[] imgBytes = (byte[])reader["blob"]; Response.ContentType = "image/jpeg"; Response.BinaryWrite(imgBytes); } } }
Comments
