Hi
my program consists of a few classes where one is a SEARCH class used for selecting for example from a checkbox that will filter my database. and the RESULT class that displays the jtable.
my problem is in the search class when i select a certain radio button it must set a string.. that string is then send to the result class where it is used in the query. when i click on a radio button it sets correct but as soon as i call it from the result class it becomes null. am i missing something?
the Search class
the Result class
my program consists of a few classes where one is a SEARCH class used for selecting for example from a checkbox that will filter my database. and the RESULT class that displays the jtable.
my problem is in the search class when i select a certain radio button it must set a string.. that string is then send to the result class where it is used in the query. when i click on a radio button it sets correct but as soon as i call it from the result class it becomes null. am i missing something?
the Search class
Code:
String q
private void yesItemStateChanged(java.awt.event.ItemEvent evt) {
if (yes.isSelected())
{
q = "y";
}
}
public String getQuery()
{
return q;
}
Code:
stmt = conn.createStatement();
Search s = new Search();
String q = s.getQuery();
PreparedStatement prep = conn.prepareStatement("SELECT * FROM employee where ee = ?");
prep.setString(1,q);
rs = prep.executeQuery();
Comment