📄 add_deal.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_id=request.getParameter("c_id");
c_id=new String(c_id.getBytes("ISO8859-1"),"gb2312");
String deal_date=request.getParameter("deal_date");
if( (deal_date != null)&&(deal_date.length()!= 0 ) )
{
deal_date = new String(deal_date.getBytes("ISO8859-1"),"gb2312");
}
String product=request.getParameter("product");
if( (product != null)&&(product.length()!= 0 ) )
{
product = new String(product.getBytes("ISO8859-1"),"gb2312");
}
String price=request.getParameter("price");
if( (price != null)&&(price.length()!= 0 ) )
{
price = new String(price.getBytes("ISO8859-1"),"gb2312");
}
String amount=request.getParameter("amount");
if( (amount != null)&&(amount.length()!= 0 ) )
{
amount = new String(amount.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);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
int deal_no=1;
String deal_no_string="";
String sql1="select deal_no from deal where c_id='"+c_id+"'";
ResultSet rs1=stmt.executeQuery(sql1);
if(rs1.next())
{
deal_no_string=rs1.getString(1);
while(rs1.next())
{
deal_no_string=rs1.getString(1);
}
deal_no=new Integer(deal_no_string).intValue()+1;
}
String sql_insert="insert into deal values('"+c_id+"','"+deal_no+"','"+deal_date+"','"+product+"','"+price+"','"+amount+"','"+remark+"')";
Statement stmt1=conn.createStatement();
stmt1.executeUpdate(sql_insert);
rs1.close();
stmt.close();
stmt1.close();
conn.close();
response.sendRedirect("main.jsp?customer_id="+c_id+"");
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -