executeQuery方法错误
private LoginActionForm getUserInfo(String userName,String userPassword,String sessionid)throws SQLException {
LoginActionForm myform=null;
Connection conn=null;
Statement stmt=null;
Statement stmt1=null;
ResultSet rs=null;
ResultSet rs1=null;
String sql="SELECT * FROM USERPURVIEW WHERE USERNAME='"+userName+"' and USERPASSWORD='"+userPassword+"'";
System.out.println(sql);
BaseDAO dao=new BaseDAO();
try{
dao.Open();
conn=dao.getConnection();
stmt=conn.createStatement();
rs=stmt.executeQuery(sql); //运行到此步时程序自动跳到System.out.println("connection is error");行
if(rs!=null){
while(rs.next()){
。。。。
。。。。。。。。。。。内容省略
}catch(SQLException e){
System.out.println("connection is error");
throw new SQLException(e.getMessage());
}finally{
dao.CloseCon();
}
return myform;
}
是哪里出错了?