...

View Full Version : how can i use a jComboBox using rowset



ami79
06-17-2008, 07:18 PM
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?
thnx

brad211987
06-18-2008, 04:10 AM
http://java.sun.com/j2se/1.5.0/docs/api/index.html?index-filesindex-1.html

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum