string cs = "data source=*;initial catalog=*;user id=*;password=*";
SqlConnection con=new SqlConnection (cs);
con.ConnectionString =cs;
con.Open ();
string sempid;
//INSERT THE VALUE TO RETRIEVE IN THIS
sempid=textBox1 .Text ;
string query="select * from xxx where emp...@id";
SqlCommand cmd=new SqlCommand (query,con);
cmd.Parameters.Add (new SqlParameter ("@id",sempid));
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
// THIS IS FOE DISPLAYING THE VALUE FROM THE dATATABLE
textBox2.Text = dr[1].ToString ();
;
;
}
hope this works for you
thanks.