title: Loading combobox from database in C#
body: <p>I am creating an application, where I can add a customer's first name, last name, email, the date, service type (pc repair), the technician PC brand, pc type, type of OS, and the problem with the computer. I am able to insert data into the MySQL database using phpMyAdmin. </p>
  
  <p>However, I a stuck on this part. I am trying to view the service order that was just created. I would like to load the combobox by the last name of the customer, and once I click on the customer's name, it populates all the fields that were mentioned above and the service number that it was inserted into the database. I am having issues loading the combobox and texfields. </p>
  
  <p>Any ideas are appreciated! If a combobox is a bad idea and there is a better way, please let me know! I tried this code, but SQLDataAdapter is not working for me. I somehow can't find an example that I can relate too.</p>
  
  <pre><code>private void cbViewServices_SelectedIndexChanged(object sender, EventArgs e)
  {
    if (cbViewServices.SelectedIndex &gt;- 1)
    {
      string lastName = cbViewServices.SelectedValue.ToString();                
      MySqlConnection conn = new MySqlConnection("server=localhost;uid=******;password=**********;database=dboserviceinfo;");
      conn.Open();
  
      SqlDataAdapter da = new SqlDataAdapter("select distinct LastName from tserviceinfo where LastName='" + lastName + "'", conn);
  
      DataSet ds = new DataSet();
      da.Fill(ds); conn.Close();
    }
  }
  </code></pre>