Hi,
I am working on a project talking to database.But I encounted a problem.
if (XXXQueryStmt==null){
String XXXQuery="SELECT * FROM "+tablename+
"WHERE "+tablename+".columnName=?"; XXXQueryStmt=con.prepareStatement
(XXXQuery);
}
XXXQueryStmt.setString(1,comboBoxItem);//err
rs=XXXQueryStmt.executeQuery();
//... some other codes
private PreparedStatement XXXQueryStmt;
private ResultSet rs;
private String tablename;//It is the tablaname in the database
//comboBoxItem is String type,which is assigned through comboBox.getSelectedItem();
the 1st round: I clicked one item in JComboBox,it shows the string of rs which is type of ResultSet.That's good.
the 2nd round & thereafter: There's a exception stating: invalid handle.I debugged, it is at XXXQueryStmt.setString(1,comboBoxItem);
Why? Anybody can help? Tks!
Frances