📄 modify_customer1.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>
<%
String c_name=request.getParameter("c_name");
c_name=new String(c_name.getBytes("ISO8859-1"),"gb2312");
String c_id=request.getParameter("c_id");
c_id=new String(c_id.getBytes("ISO8859-1"),"gb2312");
String card_id=request.getParameter("card_id");
if( (card_id != null)&&(card_id.length()!= 0 ) )
{
card_id = new String(card_id.getBytes("ISO8859-1"),"gb2312");
}
String adress=request.getParameter("adress");
if( (adress != null)&&(adress.length()!= 0 ) )
{
adress = new String(adress.getBytes("ISO8859-1"),"gb2312");
}
String sex=request.getParameter("sex");
if( (sex.equals("male")) )
{
sex="男";
}
else
sex="女";
//sex = new String(sex.getBytes("ISO8859-1"),"gb2312");
String birthday=request.getParameter("birthday");
if( (birthday != null)&&(birthday.length()!= 0 ) )
{
birthday = new String(birthday.getBytes("ISO8859-1"),"gb2312");
}
String phone=request.getParameter("phone");
if( (phone != null)&&(phone.length()!= 0 ) )
{
phone = new String(phone.getBytes("ISO8859-1"),"gb2312");
}
String mobile_phone=request.getParameter("mobile_phone");
if( (mobile_phone != null)&&(mobile_phone.length()!= 0 ) )
{
mobile_phone = new String(mobile_phone.getBytes("ISO8859-1"),"gb2312");
}
String fax=request.getParameter("fax");
if( (fax != null)&&(fax.length()!= 0 ) )
{
fax= new String(fax.getBytes("ISO8859-1"),"gb2312");
}
String email=request.getParameter("email");
if( (email != null)&&(email.length()!= 0 ) )
{
email = new String(email.getBytes("ISO8859-1"),"gb2312");
}
String remark=request.getParameter("remark");
if( (remark != null)&&(remark.length()!= 0 ) )
{
remark = new String(remark.getBytes("ISO8859-1"),"gb2312");
}
%>
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dengfen";
String user="sa";
String password="123";
Connection conn= DriverManager.getConnection(url,user,password);
String sql_modify="update customer set name='"+c_name+"',sex='"+sex+"',card_id='"+card_id+"',adress= '"+adress+"',birthday='"+birthday+"',phone='"+phone+"',mobile_phone='"+mobile_phone+"',fax='"+fax+"',email='"+email+"',remark='"+remark+"' where c_id='"+c_id+"' ";
Statement stmt1=conn.createStatement();
stmt1.executeUpdate(sql_modify);
stmt1.close();
conn.close();
response.sendRedirect("main.jsp?customer_id="+c_id+"");
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -