I want to select a photo based on user that has opened the window form.
If I put a number in the where clause, "where id=36", it shows only the photo of ID 34 (its static). How can I make it dynamic? Every user has its own photo, so it should be loaded. Code below.
cmd = new SqlCommand("select profilepic from users where id=@Id", con);
cmd.Parameters.Add("@ID", SqlDbType.Int);
cmd.Parameters["@ID"].Value = profilePic;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
MemoryStream ms = new MemoryStream((byte[])ds.Tables[0].Rows[0]["profilepic"]);
pictureBox1.Image = new Bitmap(ms);
}