java.sql.SQLException:Parameter index out of range (1 > number of parameters,which is 0).private int check(String user_name,String user_code) throws SQLException {\x05\x05// TODO Auto-generated method stub\x05\x05PreparedStatement stmt = null;\x05Str
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/29 09:55:59
![java.sql.SQLException:Parameter index out of range (1 > number of parameters,which is 0).private int check(String user_name,String user_code) throws SQLException {\x05\x05// TODO Auto-generated method stub\x05\x05PreparedStatement stmt = null;\x05Str](/uploads/image/z/11828585-65-5.jpg?t=java.sql.SQLException%3AParameter+index+out+of+range+%281+%3E+number+of+parameters%2Cwhich+is+0%29.private+int+check%28String+user_name%2CString+user_code%29+throws+SQLException+%7B%5Cx05%5Cx05%2F%2F+TODO+Auto-generated+method+stub%5Cx05%5Cx05PreparedStatement+stmt+%3D+null%3B%5Cx05Str)
java.sql.SQLException:Parameter index out of range (1 > number of parameters,which is 0).private int check(String user_name,String user_code) throws SQLException {\x05\x05// TODO Auto-generated method stub\x05\x05PreparedStatement stmt = null;\x05Str
java.sql.SQLException:Parameter index out of range (1 > number of parameters,which is 0).
private int check(String user_name,String user_code) throws SQLException {
\x05\x05// TODO Auto-generated method stub
\x05\x05PreparedStatement stmt = null;
\x05String sql ="select * from log where name='?' and code='?';";
\x05stmt = Server.con.prepareStatement(sql);
\x05stmt.setString(1,user_name);
\x05stmt.setString(2,user_code);
\x05if(stmt.executeQuery(sql)==null){
\x05\x05return 0;
\x05}
\x05 return 1;
\x05}
java.sql.SQLException:Parameter index out of range (1 > number of parameters,which is 0).private int check(String user_name,String user_code) throws SQLException {\x05\x05// TODO Auto-generated method stub\x05\x05PreparedStatement stmt = null;\x05Str
String sql ="select * from log where name='?' and code='?';";改成
String sql ="select * from log where name=?and code=?“;