11-14.txt

来自「jsp常用实例讲解」· 文本 代码 · 共 42 行

TXT
42
字号
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title> 修改留言</title>
</head>

<body bgcolor="#99CCFF">
<hr><center>
<%@ page import="java.sql.*" %>
<%-- 连接数据库使用的语句 --%>
<%
String url=new String();
String sql=new String();
url="jdbc:odbc:liuyan";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(url);
%>
<%
Statement stat=conn.createStatement();
String errorcode="";
String id=request.getParameter("id");
String emote=request.getParameter("emote");
String content=request.getParameter("content");
try{
	String strSql="update db2admin.guestbook set emote='"+emote+"',content='"+content+"' where serial_no="+id;
	stat.executeUpdate(strSql);
	out.println("<BR><font size=\"+2\" color=\"red\">祝贺,留言修改成功!</font>");
}catch(Exception e){
	errorcode=e.toString();
	out.println("<BR>DEBUG:"+errorcode);
}finally{
	stat.close();
	conn.close();
}
%>
</center>
</body>
</html>

⌨️ 快捷键说明

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