📄 deletequestion.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除试题</title>
<link href="../img/cssexamin.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.unnamed1 { font-size: 12px;
font-weight: lighter;
color: #FF0000;
text-decoration: none;
}
.style1 {
color: #0000FF;
font-size: 24px;
}
.style3 {
color: #333333;
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>
<jsp:useBean id="linejdbc" scope="page" class="examinline.DBConnectionBean" />
<%linejdbc.setdrivername();%>
<body>
<p>
<%!
String name;
String sqlstr1;
String sqlstr2;
int id;
int type2;
%>
<%
linejdbc.setdrivername();
Connection conn = linejdbc.getopenConnection();
PreparedStatement p=null;
if (request.getParameter("type2")!=null) type2=Integer.parseInt(request.getParameter("type2"));
switch (type2){
case 1:
sqlstr1="select * from chi_choose";
sqlstr2="delete from chi_choose where id=?";
name="语文";
break;
case 2:
sqlstr1="select * from maths_choose";
sqlstr2="delete from maths_choose where id=?";
name="数学";
break;
case 3:
sqlstr1="select * from eng_choose";
sqlstr2="delete from eng_choose where id=?";
name="英语";
break;
case 4:
sqlstr1="select * from log_choose";
sqlstr2="delete from log_choose where id=?";
name="逻辑";
break;
default:
%>
<script language="JavaScript">alert("请选择科目!")</script>
<%
}
id=0;
if (request.getParameter("id")!=null) id=Integer.parseInt(request.getParameter("id"));
if (id!=0)
{
p=conn.prepareStatement(sqlstr2);
p.setInt(1,id);
p.executeUpdate();
}
p=conn.prepareStatement(sqlstr1);
ResultSet result=p.executeQuery();
%>
</p>
<h3 align="center" class="style1">执行对<u class="style3"><%=name%></u>试题库的删除操作</h3>
<hr width="500" class="table">
<p> </p>
<div align="center">
<table width="564" border="2" align="center" class="table">
<tr align="center" class="table">
<td width="16%" class="table">题号</td>
<td width="46%" class="table">题目</td>
<td width="16%" class="table">操作</td>
</tr>
<%
while(result.next())
{
%>
<tr align="center" class="table">
<td class="table"><%=result.getString("id")%></td>
<td class="table"><%=result.getString("question")%></td>
<td width="13%" class="table"><a href="DeleteQuestion.jsp?id=<%=result.getInt("id")%>">删除</a></td>
</tr>
<%
}
%>
</table>
<%
/*result.close();
else
{out.print("数据库没有试题记录!!");}*/
%>
<table align="center" border="0"><tr>
<td width="25%" class="table"><div align="center"><a href="addQ222.jsp">返回选择删除科目</a></div></td>
</tr>
</table>
<p> </p>
<p><a href="main.jsp"><img src="../img/tuichu.jpg" width="72" height="42" border="0"></a></p>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -