📄 spinfo.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" language="java"%>
<%
request.setCharacterEncoding("gb2312");
%>
<%@ page import="java.sql.*,java.io.*"%>
<jsp:useBean id="conn" scope="page" class="com.mingri.dbconn.DBResult" />
<%
//regist.setSpinfo(spinfo);
//regist.regist();
String sql = null;
String newmax = null;//最大ID
String Spname = null;
String Jc = null;
String Cd = null;
String Dw = null;
String Gg = null;
String Bz = null;
String Ph = null;
String Pzwh = null;
String Gysname = null;
String Memo = null;
String str = "select max(id) as maxint from tb_brand";
ResultSet rs = conn.getResult(str);
while (rs.next()) {
String max = rs.getString("maxint"); //获得最大的字段
String maxi = max.substring(2, max.length()); //截取子字符串
newmax = "SP" + String.valueOf(Integer.parseInt(maxi) + 1);
}
Spname = request.getParameter("spname");
Jc = request.getParameter("jc");
Cd = request.getParameter("cd");
Dw = request.getParameter("dw");
Gg = request.getParameter("gg");
Bz = request.getParameter("bz");
Ph = request.getParameter("ph");
Pzwh = request.getParameter("pzwh");
Gysname = request.getParameter("gysname");
Memo = request.getParameter("memo");
sql = "insert into tb_brand values('" + newmax + "','" + Spname
+ "','" + Jc + "','" + Cd + "','" + Dw + "','" + Gg + "','"
+ Bz + "','" + Ph + "','" + Pzwh + "','" + Gysname + "','"
+ Memo + "')";
int resu = conn.executeUpdate(sql);
if (resu == 0) {
out.println("<script language='javascript'>alert('登记失败');"
+ "window.location.href='khinfo.html';</script>");
}
else {
out.println("<script language='javascript'>alert('登记成功');"
+ "window.location.href='khinfo.html';</script>");
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -