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 > numb
答案:1 悬赏:10 手机版
解决时间 2021-05-04 22:22
- 提问者网友:玫瑰园
- 2021-05-04 05:16
最佳答案
- 五星知识达人网友:逐風
- 2021-05-04 06:01
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=?;
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯