title: Display SQL query result from dropdown list selection in a label in asp.net form
body: <p>I'm trying to display the SQL query result in a label but it's not showing. The user picks a value from the dropdown list and the label should populate the result. a This is my code:</p>
  
  <pre><code>protected void drpEmployeeName_SelectedIndexChanged(object sender, EventArgs e)
  {
      String connString = ConfigurationManager.ConnectionStrings["HRPlannerConnectionString1"].ConnectionString;
      SqlConnection conn = new SqlConnection(connString); 
      string result = "SELECT EmployeeName from Employees WHERE EmployeeID= '" + drpEmployeeName.SelectedItem.Value + "'";
      SqlCommand showresult = new SqlCommand(result, conn);
      conn.Open();
      lblEmployee.Text = showresult.ExecuteScalar().ToString();
      conn.Close();
  }
  </code></pre>
  
  <p>Please help!</p>