java.sql.SQLException:Parameter index out of range (1 > numb
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/07 15:38:47
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}
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}
String sql ="select * from log where name='?' and code='?';";改成
String sql ="select * from log where name=?and code=?“;
再问: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? and code=?' at line 1
再答: String sql ="select * from log where name=? and code=?";
String sql ="select * from log where name=?and code=?“;
再问: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? and code=?' at line 1
再答: String sql ="select * from log where name=? and code=?";
java.sql.SQLException:Parameter index out of range (1 > numb
java.sql.SQLException: Parameter index out of range (1 > num
java.sql.SQLException:Parameter index out of range (0 < 1 ).
Parameter index out of range (1 > number of parameters,which
Parameter index out of range (1 > number of parameters, whic
Parameter index out of range (4 > number of parameters,which
jdbc mysql插入数据提示Parameter index out of range (1 > number of
String index out of range:-1
string index out of range
scan line index out of range
String index out of range:0
python:list index out of range