Hi developers,
I'm not sure if this is possible, but I've tried to add database elements to a list box.
There are no errors shown, but it simply does not work. Here is the code below:
if(criteria1 == 1){
getDBConnection();
try
{
stmt = conn.createStatement();
if(stmt.execute("SELECT Clients.Firstname FROM Clients WHERE Clients.Firstname= '"+ searchCriteria1 + "' "))
{
rs = stmt.getResultSet();
System.out.print("STEP 2");
}
while(rs.next()) {
//Add to record List box
searchListModel.addElement(rs.getString(1).trim());
System.out.print("STEP 3");
}
}
catch (SQLException ex) {
System.out.println("SQLException: " + ex.getMessage());
return;
}
statements, listbox, listmodel and criteria and all been previously initialised.
Thanks in advance,
Cleo