📄 collegepickfile.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="DataBaseConnection.OracleConnection" %>
<p><font color="#003366" size="+4">
<%
//如果为空就转回去
String bh = request.getParameter( "BH" );
if( bh==null||bh.trim().equals( "" ) ){
%>
<jsp:forward page ="PickTaking.jsp"/>
<%
}
//如果count不是数字就转回去
int number;
try{
number = Integer.parseInt( bh );
}catch( Exception e ) {
%>
<jsp:forward page ="PickTaking.jsp"/>
<% }
%>
<%
//获取连接对象和语句对象
Connection conn = null;
Statement stmt = null;
String user = "sox";
String password = "123";
boolean isSuccess = true;
OracleConnection oc = new OracleConnection( user, password );
try{
conn = oc.getConnection();
stmt = conn.createStatement();
}catch( SQLException e ){ System.out.println( e.getMessage()+"335" ); }
//判断存不存在该编号的考生
ResultSet rs = stmt.executeQuery( "select count(*) from college where 院校编号= '"+bh+"' " );
rs.next();
if( rs.getInt(1) == 0 ){
out.print( "不存在此院校" );
}
else{
CallableStatement cstmt = null;
try{
cstmt = conn.prepareCall ( "call proc1(?)" );
cstmt.setInt( 1, number );
cstmt.execute();
cstmt = conn.prepareCall ( "call proc2(?)" );
cstmt.setInt( 1, number );
cstmt.execute();
cstmt.close();
conn.close();
}
catch( SQLException e ){ isSuccess = false; }
if( isSuccess ) out.print( "该院校投档成功" );
else out.print( "该院校投档失败" );
}
%>
</font></p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -