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

📄 material_mod_mod.jsp

📁 很不错的!!大家可以试试!!!D:学习专业课程设计成果OA.rar
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312"%> 
<%@ page import="java.sql.*"%> 


<html><style type="text/css">
<!--
body {
	background-color: #6699FF;
}
-->
</style>
<body>
<%
String thing_id=request.getParameter("thing_id");

String newThing_name=request.getParameter("thing_name");
if(newThing_name==null)
 {newThing_name="";}
String newThing_store =request.getParameter("thing_store");
if(newThing_store ==null)
 {newThing_store ="";}
String newThing_supplyer =request.getParameter("thing_supplyer");
if(newThing_supplyer ==null || newThing_supplyer  == "")
 {newThing_supplyer ="";}

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 thing set thing_name='" + newThing_name + "',thing_store='" + newThing_store + "',thing_supplyer='" + newThing_supplyer + "' where thing_id=" + thing_id;

stmt.executeUpdate(sql);

%>
<p>修改后的信息:
<% 
ResultSet rs =stmt.executeQuery("select * from  thing ");
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("</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("</tr>");
}
out.print("</table>");
rs.close();
stmt.close();
conn.close();

%>
<p><a href="material_index.jsp">返回</p>
</body>

</html>

⌨️ 快捷键说明

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