%@ page contentType="text/html;charset=big5" language="java"%> <%@ page import="java.sql.*" %> <%@ page import="com.chtd.JDBCBean" %> <%@ include file="/WEB-INF/jspf/constants.jspf" %> <%@ include file="/WEB-INF/jspf/db.jspf" %> <% String userId = (String)session.getAttribute("userid"); // 撰寫者編號 int surveyId = 1; // 問卷編號 if (userId==null) { out.println(""); return; } // 檢查使用者是否填寫過問卷 Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn = db.getConnection(); pstmt = conn.prepareStatement("select user_id from survey_users where SURVEY_ID=? and USER_ID=?"); pstmt.setInt(1, surveyId); pstmt.setString(2, userId); rs = pstmt.executeQuery(); if(rs.next()) { out.println(""); return; } } finally { if (rs != null) { try { rs.close();} catch (SQLException e) {} rs = null; } if (pstmt != null) { try { pstmt.close();} catch (SQLException e) {} pstmt = null; } if (conn != null) { try { conn.close(); } catch (SQLException e) {} conn = null; } } %>
![]() |
|
![]() |