public void ProcessRequest (HttpContext context) { // SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString); SqlConnection cn = new SqlConnection(ConfigurationManager.AppSettings["constring"].ToString()); cn.Open(); string sql = "Select clogo from tbl_company1 where cid=@cid"; SqlCommand cmd = new SqlCommand(sql, cn); cmd.Parameters.Add("@cid", SqlDbType.Int).Value = context.Request.QueryString["cid"]; cmd.Prepare(); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); //context.Response.ContentType = dr["imagename"].ToString(); context.Response.BinaryWrite((byte[])dr["clogo"]);//error is here like "Unable to cast object of type 'System.String' to type 'System.Byte[]'"// dr.Close(); cn.Close(); }
if(dr.Read()) { //context.Response.ContentType = dr["imagename"].ToString(); context.Response.BinaryWrite((byte[])dr["clogo"]);//error is here// }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)