Parameterized Query '(@cid int)Select clogo from tbl_company1 where cid=@cid' expects parameter @cid, which was not supplied. Statement(s) could not be prepared.
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(); if (dr.Read()) { //context.Response.ContentType = dr["imagename"].ToString(); context.Response.BinaryWrite((byte[])dr["clogo"]); } dr.Close(); cn.Close(); }
context.Request.QueryString["cid"]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)