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

这里出现异常jsp+servlet代码protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{//TODOAuto-generatedmethodstubStri...

这里出现异常

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

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值