1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| DbConn db2=new DbConn(); if(db.checkTrue("select id from xianlu where tid="+tid+" and zdid="+zdid)){ json.put("msg", "该线路已有该站点"); }else if(db2.checkTrue("select id from xianlu where tid="+tid+" and xh="+xh)){ json.put("msg", "站点序号已存在"); }else{ boolean bl=db.insort("insert into xianlu(xh,tid,zdid) values("+xh+","+tid+","+zdid+")"); if(!bl){ json.put("msg", "添加成功。"); }else{ json.put("msg", "添加失败"); } } } if("piao".equals(tname)){ String tid=request.getParameter("tid"); String szdid=request.getParameter("szdid"); String ezdid=request.getParameter("ezdid"); String stime=request.getParameter("stime"); String pval=request.getParameter("pval"); String ptype=request.getParameter("ptype"); String cxzh=request.getParameter("cxzh"); String yxsj=request.getParameter("yxsj"); boolean bl=db.insort("insert into piao(szdid,ezdid,tid,stime,pval,ptype,cxzh,yxsj) values("+szdid+","+ezdid+","+tid+",'"+stime+"',"+pval+",'"+ptype+"','"+cxzh+"','"+yxsj+"')"); if(!bl){ json.put("msg", "添加成功。"); }else{ json.put("msg", "添加失败"); } } PrintWriter out=response.getWriter(); out.print(json.toString()); out.flush(); out.close(); }
public void init() throws ServletException {
|