thanks.jsp
上传用户:apbaoyuan
上传日期:2021-02-12
资源大小:1015k
文件大小:1k
- <%@page import="java.sql.*"%>
- <%@page import="java.util.*"%>
- <%@page contentType="text/html;charset=GB2312"%>
- <%@include file="opendata.jsp"%>
- <%@include file="convert.jsp"%>
- <html>
- <head>
- <title>
- 投票提交处理
- </title>
- <LINK href="style.css" rel=stylesheet>
- </head>
- <body>
- <%
- try {request.setCharacterEncoding("GB2312");
- sql = "SELECT QuestionID from Questions where IsVisable = 1 ";
- rs = smt.executeQuery(sql);
- String question = null,item = null;
- int questionid = 0;
- int itemid1;
- Statement _smt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
- Statement _smt_=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
- while(rs.next())
- { String[] vote=null;
- questionid = rs.getInt(1);
- vote=request.getParameterValues(String.valueOf(questionid));
- if(vote!=null)
- {
-
- sql = "update Questions set QuestionCount = QuestionCount + 1 Where QuestionId ="+questionid;
- _smt .executeUpdate(sql);
- for(int i=0;i<vote.length;i++)
- {
- sql = "update Items set ItemCount = ItemCount + 1 Where ItemID ="+Integer.parseInt(vote[i]);
- _smt_.executeUpdate(sql);
-
- }
- //_smt_.close();
- }
-
- }
- //rs.close();
-
-
- }
-
- catch (Exception e) {
- e.getStackTrace();
- }
- //smt.close();
- //con.close();
- response.sendRedirect("showquestion.jsp");
-
-
- %>
- </body>
- </html>