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

📄 usermodisave.jsp

📁 公文办理系统
💻 JSP
字号:
<%@page contentType="text/html;charset=GBK"%>
<%@include file="..\..\const\global.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../../const/style.css" type="text/css">
</head>
<body background="../../image/backg2.gif">
<%
String StrMsg="";
try{
	Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
	sqlCon = java.sql.DriverManager.getConnection(ConnStr,ConnUser,ConnPassword);
	sqlStmt = sqlCon.createStatement();

	String userid=new String(request.getParameter("userid").getBytes("8859_1")); 
	String pwd1=new String(request.getParameter("pwd1").getBytes("8859_1")); 
	String username=new String(request.getParameter("username").getBytes("8859_1")); 
	
	String isYes="0";
	strSQL="select * from userlist where userid='"+userid+"'";
	sqlRst = sqlStmt.executeQuery(strSQL);
	if(sqlRst.next()){
		isYes="1";
	}
	sqlRst.close();

	if(isYes.equals("1")){
		strSQL="update userlist set pwd='"+pwd1+"',username='"+username+"' where userid='"+userid+"'";
		sqlStmt.executeUpdate(strSQL);
		response.setHeader("Refresh","0;URL=default.jsp");
	}
	else{
		out.println("<font color=red>修改失败:该用户不存在!!! 5秒后自动跳转</font>");
		response.setHeader("Refresh","5;URL=default.jsp");
	}

    //关闭SQL语句对象 
    sqlStmt.close();
    //关闭数据库
    sqlCon.close();
    }catch(SQLException s) { 
        StrMsg="SQL错误信息:"+s.toString()+" "+s.getErrorCode()+" "+s.getSQLState();
    }catch(Exception e) { 
        StrMsg="错误信息:"+e.toString()+e.getMessage();
    }

	if(!StrMsg.equals("")){
		out.println("<font color=red>"+StrMsg+"</font>");
	}
%>
</body>
</html>

⌨️ 快捷键说明

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