I performed the following code to retrieve the path from database and show image
protected void Button2_Click(object sender, EventArgs e)
{
string t = TextBox2.Text.Trim();
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=D:\\Anshul\\College site\\App_Data\\afset.mdf;Integrated Security=True;User Instance=True");
SqlCommand cmd = new SqlCommand("Select dmc from Semr Where Rollno='" + t + "'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
string p = dr["dmc"].ToString();
Image2.ImageUrl = p;
}
con.Close();
Image2.Visible = true;
}
but the image is not displayed not even the control. Please help me 1 thing i am sure it retrieves the path.