sqlRst已经next完,你还在取值就会出现则中情况
用while(sqlRst.next()){//加上就行了
pd=sqlRst.getString(1);
out.println("h fjaoghio");
out.println(pd);
if(pd.equals(spaswd))
{ response.sendRedirect(response.encodeRedirectUrl("111primface.jsp"));
}
else
{ response.sendRedirect(response.encodeRedirectUrl("111error.jsp"));
}
sqlRst.close();
}
catch(java.sql.SQLException e)
{ System.err.println("db.executeQuery:"+e.getMessage());
}}
用while(sqlRst.next()){//加上就行了
pd=sqlRst.getString(1);
out.println("h fjaoghio");
out.println(pd);
if(pd.equals(spaswd))
{ response.sendRedirect(response.encodeRedirectUrl("111primface.jsp"));
}
else
{ response.sendRedirect(response.encodeRedirectUrl("111error.jsp"));
}
sqlRst.close();
}
catch(java.sql.SQLException e)
{ System.err.println("db.executeQuery:"+e.getMessage());
}}
如果userid是字符型的,你换成下面写法
strSQL="select password from userinfo where userid='"+no+"'";然后在rs.next()的时候,先判断它是否为空
if(rs.next())
pd=rs.getString(1);