Dear Gregg Bolinger,
Can you show me how to apply this few code into my find class...because when i try to apply this code there were errors which is cannot resolves symbols (pointed to DB.FIELD and the DB stand for database name, FIELD stand for field name??)
boolean CHECKED = false;
if (DB.FIELD == 0) CHECKED = false;
if (DB.FIELD == 1) CHECKED = true;
JCheckBox check = new JCheckBox("Available");
check.setSelected(CHECKED);
Below is my find class:
public class FindRecord implements ActionListener {
public void actionPerformed(ActionEvent e) {
try {
if (!pFnametxt.getText().equals("")&&!pLnametxt.getText().equals("")) {
//start the query here!
String find = "SELECT * FROM contactmanager " +
"WHERE p1stname = '" + pFnametxt.getText() + "'&& plastname = '" + pLnametxt.getText() + "'";
ResultSet rs = statement.executeQuery(find);
boolean moreRecord = rs.next();
if (moreRecord)
{
pLnametxt.setText(rs.getString(2));
pNicktxt.setText(rs.getString(3));
pMobiletxt.setText(rs.getString(4));
pReligiontxt.setText(rs.getString(5));
pEmail1txt.setText(rs.getString(6));
pEmail2txt.setText(rs.getString(7));
pWebtxt.setText(rs.getString(8));
gender.setSelectedItem(rs.getString(9));
pOccupationtxt.setText(rs.getString(10));
oCompanytxt.setText(rs.getString(11));
oAddtxt.setText(rs.getString(12));
oCitytxt.setText(rs.getString(13));
oStatetxt.setText(rs.getString(14));
oZiptxt.setText(rs.getString(15));
oCountrytxt.setText(rs.getString(16));
oPhonetxt.setText(rs.getString(17));
oFaxtxt.setText(rs.getString(18));
oPositiontxt.setText(rs.getString(19));
oDepartmenttxt.setText(rs.getString(20));
oEmailtxt.setText(rs.getString(21));
oWebtxt.setText(rs.getString(22));
hAddtxt.setText(rs.getString(23));
hCitytxt.setText(rs.getString(24));
hStatetxt.setText(rs.getString(25));
hZiptxt.setText(rs.getString(26));
hCountrytxt.setText(rs.getString(27));
hPhonetxt.setText(rs.getString(28));
hFaxtxt.setText(rs.getString(29));
textArea.setText(rs.getString(30));
pBirthtxt.setText(rs.getString(31));
phototxt.setText(rs.getString(32));
//reminder.setSelected(rs.getBoolean(33));
}
else
JOptionPane.showMessageDialog(null,"No such Record!");
}
else
JOptionPane.showMessageDialog(null,"Enter First Name And Last Name To Find!");
}
catch (SQLException sqlex) {
sqlex.printStackTrace();
JOptionPane.showMessageDialog(null, "Error: " + sqlex.toString());
}
catch (Exception ee) {
ee.printStackTrace();
JOptionPane.showMessageDialog(null, "Errorlah ! " +
ee.toString());
}
}
}
THANK YOU SO MUCH!