I have a form that has a combobox that gets populated from a database query. The combobox contains the first and last name of a person that I appended from the two fields in the table. I have used MS Access and you can hide columns in the combo box and retrieve them for search functions later. I can't figure out how to create the correct query. My thought process has gone several ways, but can't find the code to do it: I am thinking I might have to somehow pass the id to the slot?
Here is what I have so far:

Qt Code:
  1. void MainWindow::on_cmbRider_currentIndexChanged(int index)
  2. {
  3.  
  4. QString Sqlstring;
  5. QSqlQuery query ;
  6. Sqlstring="SELECT LName, FName , weight , notes * FROM rider WHERE id=" + ui->cmbRider->currentIndex(0); // this won't work because the id is not in the combobox.
  7. query.prepare(Sqlstring);
  8. query.exec();
  9.  
  10. ui->txtFName->text().clear();
  11. ui->txtFName->text()=(query.value (0));//not sure if this will work either
  12. }
To copy to clipboard, switch view to plain text mode 
Thanks for your help!