forked from estanie/dbproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert_verify.jsp
43 lines (41 loc) · 1.01 KB
/
insert_verify.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.sql.*" %>
<%@ include file="dbconfig.jsp" %>
<html>
<head><title></title></head>
<body>
<%
int s_id = (Integer) session.getAttribute("id");
String c_id = request.getParameter("c_id");
String c_id_no = (request.getParameter("c_id_no"));
%>
<%
String result = null;
CallableStatement cstmt = myConn.prepareCall("{call InsertEnroll(?,?,?,?)}");
cstmt.setInt(1, s_id);
cstmt.setString(2, c_id);
cstmt.setString(3, c_id_no);
cstmt.registerOutParameter(4, java.sql.Types.VARCHAR);
try {
cstmt.execute();
result = cstmt.getString(4);
%>
<script>
alert("<%= result %>");
location.href = "insert.jsp";
</script>
<%
} catch (SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
} finally {
if (cstmt != null)
try {
myConn.commit();
cstmt.close();
myConn.close();
} catch (SQLException ex) {
}
}
%>
</form></body>
</html>