A sample code
string str1 = "Select Name from Login where Login='" + EmpID.Text + "'";
SqlCommand cmd1 = new SqlCommand(str1, con1);
cmd1.ExecuteNonQuery();
SqlDataReader dr;
dr = cmd1.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
txtEmpName.Text = Convert.IsDBNull(dr["EmpName "]) ? "" : Convert.ToString(dr["EmpName "]);
}