今日学习内容
<%@ page import="java.sql.*" %><%--Created by IntelliJ IDEA.
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%
int cid=(int)session.getAttribute("cid");
String renshu=request.getParameter("renshu");
;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
request.setCharacterEncoding("utf-8");
Connection conn = null;
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/2017xuanke", "root", "123456");
Statement stat = null;
stat = conn.createStatement();
String sql = "UPDATE course set renshu=('"+renshu+"') where cid= ('"+cid+"') " ;
stat.executeUpdate(sql);
out.println("修改成功");
stat.close();
conn.close();
%>
</body>
</html> 标签:stat,cid,int,11.22,renshu,close,conn From: https://www.cnblogs.com/zjm921/p/17908601.html