exposing the two problems hoping for your answer:
1) I want to list in each row of a combobox names and names for doctors. I managed to do so only for names (or names only), but not both. This is what I should change:
/ / from the form where I make a combobox called the Database class that contains the functions (I think that goes well)
The query to return the names of the doctors is simple (just add nome_medico after SELECT), but as I change the function to put your name and surname in the same row?Code:Database db = new Database (); Public Vector doctor; ..... Medical db.elenco_medicine = (); for (int i = 0; i <medico.size (); i + +) ( Combo_dottori.addItem (medico.get (i));) / / This is the function in class Database Elenco_medicine Vector () ( Vector res = new Vector (); ris.add ( "empty"); String q = null; String error = start (); q = "SELECT cognome_medical FROM doctor"; try ( Statement st = connection.createStatement (); ResultSet rs = st.executeQuery (q); if (rs.isBeforeFirst ()) ( ris.removeAllElements (); ris.add ( "All the doctors");) else ( ris.removeAllElements (); ris.add (error); ) while (rs.next ()) ( ris.add (rs.getString ( "cognome_medical")); )) Catch (Exception e) ( / / SE generates a SqlException RETURNED TO THE CLIENT TO INFORM ris.removeAllElements (); ris.add (e.ToString ()); ) return res; )
2) I need to set some text as jTextField the results of a query ... I need practice in the consideration for the queries in the combobox ke do so:
I hope to be clear..... otherwise ask...Code:for (int i = 0; i <medico.size (); i + +) ( Combo_dottori.addItem (medico.get (i));)


Reply With Quote

Bookmarks