1. Database Operations 2. Verify user 2.1. Inquire
String sql = String.Format ("SELECT count (*) from user where name= '%s ' and password= '%s ');" , UserName, userpass); int row = 0; jb.queryforobject (sql, Integer. class, row);
The user is judged by the value of row.
2.1. Error
Parameter index out of range (1 > number of parameters, which is 0)
2.1.1. SQL statements
No problem after the test.
2.1.2. Guess a
The format statement was wrong and was found right after the check
2.1.3. Guessing two
int changed to integer, not changed
2.1.4. Or start with the hint itself
It's like saying Jb.queryforobject (sql, Integer.class, row); There is a problem. Check online, instead:
Integer row = (integer) jb.queryforobject ( "SELECT COUNT (*) from user where name=? and password=?",new
object[] {userName, userpass}, Java.lang.Integer. class);
- It worked!!!
- '%d ' or '? ' to change ?
- It should be thought that the connection was successful and that the error was on the query.
Java Authentication user name, password