try like this.
string s = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(s);
SqlCommand cmd = new SqlCommand("select * from table where Id='" + value + "'", con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Id",value);
cmd.Connection = con;
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
TextBox1.Text = dr["username"].ToString();
TextBox2.Text = dr["password"].ToString();
TextBox3.Text = dr["fname"].ToString();
TextBox4.Text = dr["gender"].ToString();
}
dr.Close();
con.Close();