📄 supplyer_mod_mod.jsp
字号:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html><style type="text/css">
<!--
body {
background-color: #6699FF;
}
-->
</style>
<body>
<%
String supplyer_id=request.getParameter("supplyer_id");
String newSupplyer_name=request.getParameter("supplyer_name");
if(newSupplyer_name==null)
{newSupplyer_name="";}
String newSupplyer_address =request.getParameter("supplyer_address");
if(newSupplyer_address ==null)
{newSupplyer_address ="";}
String newSupplyer_phone =request.getParameter("supplyer_phone");
if(newSupplyer_phone ==null || newSupplyer_phone == "")
{newSupplyer_phone ="";}
String newSupplyer_zip =request.getParameter("supplyer_zip");
if(newSupplyer_zip ==null || newSupplyer_zip == "")
{newSupplyer_zip ="";}
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
}catch(ClassNotFoundException event){out.print(event);}
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=oa110";
String user="sa";
String password="";
String sql = "";
Connection conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement();
sql = "update supplyer set supplyer_name='" + newSupplyer_name + "',supplyer_address='" + newSupplyer_address + "',supplyer_phone='" + newSupplyer_phone + "',supplyer_zip='" + newSupplyer_zip + "' where supplyer_id=" + supplyer_id ;
stmt.executeUpdate(sql);
%>
<p>修改后的信息:
<%
ResultSet rs =stmt.executeQuery("select * from supplyer ");
out.print("<table border>");
out.print("<tr>");
out.print("<th width=100>"+"供应商id");
out.print("<th width=100>"+"供应商名称");
out.print("<th width=100>"+"供应商地址");
out.print("<th width=100>"+"供应商电话");
out.print("<th width=100>"+"供应商邮编");
out.print("</tr>");
while ( rs.next() )
{ out.print("<tr>");
out.print("<td>"+rs.getInt(1)+"</td>");
out.print("<td>"+rs.getString(2)+"</td>");
out.print("<td>"+rs.getString(3)+"</td>");
out.print("<td>"+rs.getString(4)+"</td>");
out.print("<td>"+rs.getString(5)+"</td>");
out.print("</tr>");
}
out.print("</table>");
rs.close();
stmt.close();
conn.close();
%>
<p><a href="supplyer_mod_mod.jsp">返回</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -