I am working on my Project in Netbeans entitled Car reservation system. I've encountered an error in my log in form codes. Once I clicked the login button java.lang.NullExceptionPoint error showed up. Any suggestions for my codes? thanks
Here is my code:
private void cmdloginMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
String sql = txtusername.getText() + "'select * from tblelogin where username='" + "' and userpass='" + txtuserpass.getText() + "'";
try {
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
if (rs.next()) {
JOptionPane.showMessageDialog(null, "Correct");
} else {
JOptionPane.showMessageDialog(null, "Invalid username or password");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}