Combox. AddActionListener (new ActionListener () {
@ Override
Public void actionPerformed (an ActionEvent e) {
The String I=(String) combox. GetSelectedItem (). The toString ();
If (I=="administrator") {
Selete=1;
}
Else if (I=="employees") {
Selete=2;
}
}
});
This is a assignment after the implementation of different SQL statements
String SQL=null;
The database db1=new database (SQL);
If (selete==1) {
SQL="select loginname and password, the status from user_inf where loginname='" + +" usercode' and password='" + passcode + "' ";
} else if (selete==2) {
SQL="select name, password from employee_inf where name='" + +" usercode' and password='" + passcode + "' ";
}
SQL=run time error is null
CodePudding user response:
String comparison using equelsIf you don't set up, so there was no selete values, the judgment is not established
CodePudding user response:
equalsCodePudding user response: