Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-17-2008, 06:18 PM #1
- Join Date
- Jun 2008
- Thanked 0 Times in 0 Posts
how can i use a jComboBox using rowset
Hello, i'm trying to use a jComboBox to search data on my database.
i'm using this code:
rs.setCommand("SELECT * FROM aanmeldingsformulier WHERE" + jComboBox1.getSelectedItem() + " = ?");
but when a i run it gives me this error: java.sql.SQLException: no value specified for parameter 1.
can someone help me?
06-18-2008, 03:10 AM #2
If you look at the Java API(linked above), JComboBox returns an Object. You will probably need to cast this as a String to place it in your query. On a side note, you may want to look into prepared statements, as they are generally considered more secure than concatenating strings dynamically in your query.