public boolean check(User user){
//String sql="select count(*) from USERS where userName=? and password=?";
//Connection conn=getMyConnection();
String sql="select count(*) from USERS where userName='?' and password='?'";
Connection conn=getMySQLConnection();
ResultSet rs=null;
PreparedStatement pst=null;
try {
pst=conn.prepareStatement(sql);
pst.setString(1, user.getUserName());
pst.setString(2, user.getUserpwd());
rs=pst.executeQuery();
if(rs.next())
{
if(rs.getInt(1)==1)return true;
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeAll(rs, pst, conn);
}
return false;
}报异常:Parameter index out of range (1 > number of parameters, which is 0).!!请问是怎么回事阿?