我做的个库存管理系统,在出库的时候判断所要出库的数量不大于库存量,我不知道具体格式是什么样,哪位高手帮我改改.其中rs.getString("shuliang")是库存量,'"+shuliang+"'是要取的数量
代码如下:
while (rs.next())
{
if(rs.getString("shuliang"))<='"+shuliang+"')
{
sql="insert into rkb(shijian,fangshi,danwei,fenlei,mingcheng,xinghao,danjia,shuliang,jldw,heji,fl) values (to_date('"+shijian+"','yyyy-mm-dd'),'"+fangshi+"','"+danwei+"','"+department+"','"+division+"','"+speciality+"','"+danjia+"','"+shuliang+"','"+jldw+"','"+heji+"','0')";
sql1="update wupinbiao set shuliang=shuliang-'"+shuliang+"',heji=heji-'"+heji+"' where FENLEI='"+department+"' and LEIXING='"+division+"' and XINGHAO='"+speciality+"' ";
stmt.executeUpdate(sql);
stmt.executeUpdate(sql1);
response.sendRedirect("d.htm");
}
代码如下:
while (rs.next())
{
if(rs.getString("shuliang"))<='"+shuliang+"')
{
sql="insert into rkb(shijian,fangshi,danwei,fenlei,mingcheng,xinghao,danjia,shuliang,jldw,heji,fl) values (to_date('"+shijian+"','yyyy-mm-dd'),'"+fangshi+"','"+danwei+"','"+department+"','"+division+"','"+speciality+"','"+danjia+"','"+shuliang+"','"+jldw+"','"+heji+"','0')";
sql1="update wupinbiao set shuliang=shuliang-'"+shuliang+"',heji=heji-'"+heji+"' where FENLEI='"+department+"' and LEIXING='"+division+"' and XINGHAO='"+speciality+"' ";
stmt.executeUpdate(sql);
stmt.executeUpdate(sql1);
response.sendRedirect("d.htm");
}
解决方案 »
- 急!程序实现FTP上文件时,一个FTP帐号在几台机器上同时上传文件问题?请教高手
- 求js时间控件,可能精确的小时分秒
- 初学者请教问题之五:空指针问题
- 怎么在提交表单时,把表单里所有的checkbox自动全部选中?
- 电信的asp分为哪几种用户?
- 我是沈阳东软的,希望结交朋友,msn: [email protected]
- 请问request的生存周期是什么?
- 怎样让Frame类创建的窗口的最大化按钮失效?
- 服务器端如何用java的Servlet得到远程访问的客户端的IP和端口号?最好有代码。谢谢各位大虾。!
- 请问如何多表查询主表记录和每条记录总点击数并一起返回?
- windows2003 tomcat5.5 上不能上传文件
- 如何让eclipse的HTMLEditor插件支持struts标签
else
{
%>
<html>
<body>
<p><a href="Register.jsp">请返回</a></p>
</body>
</html>
<%
out.println("对不起,库存不够出库的数量");
}
%>
while中嵌套sql的insert和update.执行效率慢而且错误率高.
你可以先把所有想要的放一变量中
然后进行变量的判断
这句话报unclosed character literal的错误
if(xx>=(int)request.getParameter("shuliang"))
提示错误如下
/usr/java/jakarta-tomcat-5.0.28/work/Catalina/localhost/_/org/apache/jsp/shouji/chukutj_jsp.java:127: inconvertible types
found : java.lang.String
required: int
if(xx>=(int)request.getParameter("shuliang"))
^