Skip to main content

Error with java.lang.NullPointerException

No replies
inimitable
Offline
Joined: 2008-08-26
Points: 0

public DeliveryCheckListForm() {

initComponents();
jbtnSubmit.addActionListener(this);
jbtnClear.addActionListener(this);
jbtnExit.addActionListener(this);
jbtnSearch.addActionListener(this);

}

public void actionPerformed(ActionEvent e)
{
if(e.getSource()==jbtnSubmit)
{
initializeDB();
addPBSNDB();
}
if(e.getSource() == jbtnClear)
{
jtfUsername.setText("");
jtfHostName.setText("");
jtfSerialNumber.setText("");
jtfMonitorSN.setText("");

}

if(e.getSource() == jbtnExit)
{
exitDB();
}

if(e.getSource() == jbtnSearch)
{
searchSN();
}

}

public void searchSN()
{

try
{
String sqlSearchSN = ("SELECT * FROM StoreRecord WHERE SN = '" +jtfSerialNumber.getText()+ "';");
rsSearchSN = stmtSearch.executeQuery(sqlSearchSN);
while(rsSearchSN.next())
{
jtfSerialNumber.setText(rsSearchSN.getString("SN"));
//jtfSerialNumber.setEnabled(true);

}
}catch(Exception ex)
{
JOptionPane.showMessageDialog(null,""+ex.toString());
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------
i having problem with search button, when i try to search it will prompt out (java.lang.NullPointerException)

i have no problem with insert submit button. may i know where is the error ?

thanks

AttachmentSize
nullpoint.png5.92 KB