I designed the login interface, and it compares the information that you entered with the information that is in the database. When I step on the login, this problem appears. I read about this problem and understood that it occurs when I call the value in the variable, but there is no value in the variable to call it.
But the variables that I want to compare with have values that I entered
private void admin_loginActionPerformed(java.awt.event.ActionEvent evt) {
//These are the variables in which the username and password that you entered are stored and compared to them
String namee=name_admin.getText();
int pass=Integer.parseInt(pass_admin.getText());
try {
line 128 pre=con.prepareStatement("Select * from adminn where adm_name='"+namee+"' and adm_password='"+pass+"'");
ru=pre.executeQuery();
if (ru.next()) {
System.out.println("login done");
} else {
System.out.println("login faild");
}
} catch (Exception er) {
er.printStackTrace();
System.out.println(er);
}
}
private void back_libActionPerformed(java.awt.event.ActionEvent evt) {
library ii = new library();
dispose();
ii.setVisible(true);
}
This is the code where the problem occurred
`
java.lang.NullPointerException
java.lang.NullPointerException
at ad_login.admin_loginActionPerformed(ad_login.java:128)
Here is a screenshot of the database that I want to compare against screen shot of database
And this is a picture of my entries in the login interface
`screen shot of my input in login form
I checked the variables and it turned out that they are correct and there is nothing wrong with them