1.try"select * from authority where password = '" + password + "'";or"select * from authority where username = '" + username + "'";2.
try{
//....
rs.close();
stat.close();
con.close();
return true;
}
catch(Exception e){
System.out.println(e.getMessage());
}
return false;

解决方案 »

  1.   

    建议不使用 select *  这种方式。
    还是指定要取哪一列比较好
      

  2.   

    第一个还不太明白,可能跟access的一些特性或者你的数据库设计有关,没用过access。
    对于
    //第23行的return false语句放在18行与19行之间为何会出错提示:isValid()缺少返回语句。
    因为异常是前面语句抛出的,如果你catch了,程序运行时发生异常,将直接跳到20行执行catch块,而那里没有返回。请参考java异常教程(这是java与c++等不同的地方,需要好好理解。
      

  3.   

    感谢karma的指点,问题解决了。
    但为何
    "select * from authority where password = "+ password;
    又可以执行?
    请再赐教。
      

  4.   

    使用username的时候和Access的保留字重复;
    而password不是Access的保留字。