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

📄 adduselog.jsp

📁 保险管理系统 JAVA写的 适用于毕业设计 论文稍后就发
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%request.setCharacterEncoding("gb2312");%> 
<%  
   try{ 
     String target_id=request.getParameter("target_id");
     String custom_id=request.getParameter("custom_id");
     String person_id=request.getParameter("person_id");
     String custom_property=request.getParameter("custom_property");
     String custom_name=request.getParameter("custom_name"); 
     String custom_address=request.getParameter("custom_address");
     String custom_remark=request.getParameter("custom_remark");
	 String leader=request.getParameter("leader");
     String year1=request.getParameter("year1");
     String month1=request.getParameter("month1");
     String day1=request.getParameter("day1");
     String phone=request.getParameter("phone"); 	
     String mobile_phone=request.getParameter("mobile_phone");
     String fax=request.getParameter("fax");
     String booker=request.getParameter("booker");
     String password=request.getParameter("password"); 
     /*String Photo=request.getParameter("Photo"); */
	 if(custom_property.equals("")) out.print("<script>alert('请输入客户性质!');window.location.href='useradd.jsp'</script>");
	 else if(fax.equals("")) out.print("<script>alert('请输入传真号码!');window.location.href='useradd.jsp'</script>");
	 else if(phone.equals("")) out.print("<script>alert('请输入电话号码!');window.location.href='useradd.jsp'</script>");
     else{
       String driver= "sun.jdbc.odbc.JdbcOdbcDriver";
       Class.forName(driver).newInstance();
       String ConURL = "jdbc:odbc:login";
       Connection con = null;
       con = DriverManager.getConnection(ConURL,"sa","453558337");
       Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
      if(custom_id==null)out.print("<script>alert('请输入客户号!');window.location.href='useradd.jsp'</script>");
	  else {
      String sqlquerystring="UPDATE customtable SET person_id='"+person_id+"',custom_property='"+custom_property+"',custom_name='"+custom_name+"',custom_address='"+custom_address+"',custom_remark='"+custom_remark+"',leader='"+leader+"',year1='"+year1+"',month1='"+month1+"',day1='"+day1+"',phone='"+phone+"',mobile_phone='"+mobile_phone+"',fax='"+fax+"',booker='"+booker+"',password='"+password+"'";
      sqlquerystring+=" "+"WHERE custom_id LIKE"+""+"'"+custom_id+"'";
	  stmt.executeUpdate(sqlquerystring);
      /*rs.updateString(3,person_id);
      rs.updateString(4,custom_property);
      rs.updateString(5,custom_name);
      rs.updateString(6,custom_address);
      rs.updateString(7, custom_remark);
      rs.updateString(8,leader);
	  rs.updateString(9,year1);
      rs.updateString(10,month1);
      rs.updateString(11,day1);
      rs.updateString(12,phone);
      rs.updateString(13,mobile_phone);
      rs.updateString(14,fax);
      rs.updateString(15,booker);
      rs.updateString(16,password);
      rs.insertRow();
      SQLWarning warn=rs.getWarnings();
      if(warn!=null){
          out.println("---------------Warning-----------");
          out.println("<br>");
          while(warn!=null){
            out.println("Message:"+warn.getMessage());
            out.println("<br>");
            out.println("SQLState:"+warn.getSQLState());
            out.println("<br>");
            out.println("Vendor error code:");
            out.println("<br>");
            warn=warn.getNextWarning();
          }
     } 
     rs.close();*/
     stmt.close();
     con.close();
	 out.print("<script>alert('添加成功')</script>");
     String redirectURL="welcome.jsp";
     response.sendRedirect(response.encodeURL(redirectURL));
     }
	}
 }
catch(SQLException ex) { 
      out.println("SQLException caught");
      out.println("<br>");
      while(ex!=null){
      out.println("Message:"+ex.getMessage());
      out.println("<br>");
      out.println("SQLState:"+ex.getSQLState());
      out.println("<br>");
      out.println("ErrorCode:"+ex.getErrorCode());
      out.println("<br>");
      ex=ex.getNextException();
      }
} 
 %>
</body>
</html>

⌨️ 快捷键说明

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