当前位置: > java.sql.SQLException:Parameter index out of range (1 > number of parameters,which is 0)....
题目
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}

提问时间:2020-11-11

答案
String sql ="select * from log where name='?' and code='?';";改成
String sql ="select * from log where name=?and code=?“;
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.