NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
zahidaoui
Joined: 26 May 2012 Posts: 2
|
Posted: Sat May 26, 2012 10:47 pm Post subject: i need to use the result of an sql query in another ! |
|
|
i need to use the result of one query in the other. i just can't figure it out. this is the code that i came up with but it doesn't work:
try
{
Class.forName(driver).newInstance();
cn = (Connection) DriverManager.getConnection(url,user,pas…
Statement st=(Statement) cn.createStatement();
ResultSet ra=(ResultSet) st.executeQuery("select idcategorie from categorie_client where categorie_client.nom_categorie=' "+jComboBox1.getSelectedItem()+" ' ");
int id= ra.getInt("idcategorie");
ResultSet rs=(ResultSet) st.executeQuery("select * from clients where clients.idcategorie= 'id' ");
while(rs.next())
{
jComboBox2.addItem(rs.getString("name"))…
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
So does anyone have any idea ?! Thank you |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|