NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

i need to use the result of an sql query in another !

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
zahidaoui



Joined: 26 May 2012
Posts: 2

PostPosted: Sat May 26, 2012 10:47 pm    Post subject: i need to use the result of an sql query in another ! Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo