title: Populating textbox from after selecting value from comboBox
body: <p>I am trying to populate my textbox after selecting a value from my comboBox.</p>
  
  <p>My code is running fine, I don't have any errors when I run it but when I select a value from my comboBox, it's not populating my textbox. See my code below.</p>
  
  <pre><code>    private OleDbConnection connection = new OleDbConnection();
  
      public Form1()
      {
          InitializeComponent();
          connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ASUS\Documents\appointment2.accdb";
      }
  
      private void Lastname_SelectedIndexChanged(object sender, EventArgs e)
      {
  
          try
          {
              connection.Open();
              OleDbCommand command = new OleDbCommand();
              command.Connection = connection;
  
  
              OleDbDataReader reader = command.ExecuteReader();
              while (reader.Read())
              {
                  string query = "select * from appointments where patientNo = '" + Lastname.Text + "' ";
                  command.CommandText = query;
  
                  Firstname.Text = reader["firstName"].ToString();
                  patientNum.Text = reader["patientNo"].ToString();
                  contactNum.Text = reader["contactNo"].ToString();
  
              }
              connection.Close();
          }
          catch (Exception ex)
          {
              MessageBox.Show("Error" + ex);
          }
      }
  </code></pre>