⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatestudent.jsp

📁 实习的时候做的数字校园系统
💻 JSP
字号:
<!--首先导入一些必要的packages-->

<!--告诉编译器使用SQL包-->
<%@ page import="java.sql.*"%>

<%@ page import="com.xxgl.data.DBconnection"%>
<!--设置中文输出-->
<%@ page contentType="text/html; charset=GB2312" %> 

<html>
<head>
  <title>DbJsp.jsp</title>
</head>
<body>
<%
int count=0;
//以try开始
try
{ //以try开始

String test_id =request.getParameter("test_id");
test_id=new String (test_id.getBytes("ISO-8859-1"),"GBK");
String yesorno =request.getParameter("yesorno");
yesorno=new String (yesorno.getBytes("ISO-8859-1"),"GBK");


 //建一个数据库连接
Connection con = DBconnection.getConnection();
Statement stmt;

stmt = con.createStatement();
//修改记录
String sql="update newstudent set yesorno='"+yesorno+"'  WHERE testid='"+test_id+"'";

 count=stmt.executeUpdate(sql);


//关闭数据库连结
stmt.close();
con.close();
}

//捕获错误信息
catch (Exception e) {out.println(e.getMessage());}

%>

<script language="javascript">
if (<%=count%> == 1)
alert("缴费信息修改成功!"); 
else
alert("缴费信息修改失败!");
window.location.href("selectstudent1.jsp");
</script>


</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -