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

📄 gaihou.jsp

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


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

String newCompany_name=request.getParameter("company_name");
if(newCompany_name==null)
 {newCompany_name="";}
String newAddress =request.getParameter("address");
if(newAddress ==null)
 {newAddress ="";}
String newTelephone =request.getParameter("telepone");
if(newTelephone ==null || newTelephone  == "")
 {newTelephone ="";}
String newEmail=request.getParameter("email");
if(newEmail==null || newEmail=="")
 {newEmail="";}
String newBusiness =request.getParameter("business");
if(newBusiness ==null)
 {newBusiness ="";}
String newProject =request.getParameter("project");
if(newProject ==null)
 {newProject ="";}

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 basic_user set company_name='" + newCompany_name + "',address='" + newAddress + "',telephone='" + newTelephone + "',email='" + newEmail + "',business='" + newBusiness + "',project='" + newProject + "' where company_id=" + company_id ;

stmt.executeUpdate(sql);

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

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

</html>

⌨️ 快捷键说明

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