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;
try{
//....
rs.close();
stat.close();
con.close();
return true;
}
catch(Exception e){
System.out.println(e.getMessage());
}
return false;
还是指定要取哪一列比较好
对于
//第23行的return false语句放在18行与19行之间为何会出错提示:isValid()缺少返回语句。
因为异常是前面语句抛出的,如果你catch了,程序运行时发生异常,将直接跳到20行执行catch块,而那里没有返回。请参考java异常教程(这是java与c++等不同的地方,需要好好理解。
但为何
"select * from authority where password = "+ password;
又可以执行?
请再赐教。
而password不是Access的保留字。