Displaying Image in a gridview
hi sir,
i am displaying image in gridview ,initially i am inserting image in data base ,it works fine but when i am trying to display it in grid ,here problem comes ,how can i pass Id of image ,why v cant do it using only one pages
here is my code :
SqlConnection cn = new SqlConnection("Data Source=KLINFOIT2;Initial Catalog=Vinod;Integrated Security=True");
cn.Open();
DataSet ds = new DataSet();
byte[] arrContent;
DataRow dr;
string strSql;
strSql = "SELECT img_data FROM Image Where img_pk=20";
SqlDataAdapter da = new SqlDataAdapter(strSql, cn);
da.Fill(ds);
dr = ds.Tables[0].Rows[0];
arrContent = ((byte[])dr.ItemArray["img_data"]);
string conType = dr.ItemArray["img_contenttype"].ToString();
Response.ContentType = conType;
Response.OutputStream.Write(arrContent, 0, (Byte[])dr.Item["imgLength"]);
Response.End();
Please rep
Vinod
|