Parameswaran R

Parameswaran R

  • NA
  • 254
  • 6.5k

PictureBox

Nov 6 2015 6:24 AM

I have a Question! How to fill images to picture box. The image name stored in SQL DB. I want to display Image Which I have stored in DB. I try following code, But didn't work. Please any one Help???

E-Mail [email protected]

try
{
con.Open();
string path="D:\task\taskConsoleForms\taskConsoleForms\\Images";
SqlCommand cmd = new SqlCommand("select * from tbl_Users where usr_id='"+usrid+"'", con);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
txtUid.Text = reader["usr_id"].ToString();
txtFirstname.Text = reader["fname"].ToString();
txtLastname.Text = reader["lname"].ToString();
txtEmail.Text = reader["email"].ToString();
txtPassword.Text = reader["pass"].ToString();
txtDate.Text = reader["created_date"].ToString();
pictureBox1.ImageLocation =path + reader["imgpath"].ToString();

}
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}


Answers (2)