java.sql.SQLException: No ResultSet was produced 出现异常应该怎么修改代码

这里出现异常jsp+servlet代码protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponser... 这里出现异常
jsp+servlet代码
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String email=request.getParameter("email");
String login=request.getParameter("login");
String password=request.getParameter("password");
String confirmpass=request.getParameter("confirmpass");
PrintWriter out=response.getWriter();
DBConnAccess DBConn=new DBConnAccess();
String dbpath = "test.mdb"; //
Connection conn = DBConn.getConnToAccess(request.getSession().getServletContext().getRealPath(dbpath));

Statement stmt=null;
ResultSet rs = null;

try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
String sql = "insert into username(email,login,pwd)values('"+email+"','"+login+"','"+password+"')";
out.println(login);
rs = stmt.executeQuery(sql);
out.println(login);
String selectsql="select *from username";
ResultSet rs1 = stmt.executeQuery(selectsql);
while (rs1.next()) {
out.println(rs.getString("login"));
}
} catch (Exception e) {
// TODO Auto-generated catch block
out.println(e);
e.printStackTrace();
}

DBConn.close();

regInfo.setMess("");
//验证成功调用ProcessData对象的update方法将注册信息添加入数据库

//regInfo.setMess("注册成功,请重新登录!");
//response.sendRedirect("signin.jsp");
//RequestDispatcher requestDispatcher=request.getRequestDispatcher("signshow.jsp");
//requestDispatcher.forward(request, response);

}
求教连接access
展开
 我来答
b94665
2014-12-25 · TA获得超过3846个赞
知道小有建树答主
回答量:1032
采纳率:83%
帮助的人:259万
展开全部
insert into 语句用executeUpdate()方法,并且不返回结果集……
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式