新微赢技术网
标题:
还是那个判断语句 的困惑
[打印本页]
作者:
清风
时间:
2009-12-27 03:32
标题:
还是那个判断语句 的困惑
我想 如果库里存在 那么就更新已有库存
如果库里不存在 则添加新纪录
但是这样写 总是执行IF后面 语句 我把rs.addnew 放在前面
它就执行rs.addnew 始终不作判断哦
有大虾指点为:
if not rs.eof then
rs("now_name")=request("now_name")
.
.
.
rs.update
else
rs.addnew
rs("now_name")=request("now_name")
.
.
.
rs.update
end if
看看我改的对不
但是还是不行 郁闷
<!--#INCLUDE FILE="data1.asp" -->
<!--#INCLUDE FILE="html.asp" -->
<%
temp1=request("now_name")
set rs=server.CreateObject("adodb.recordset")
sql="selcet * from nowmaterial where now_name='"&temp1&"'"
rs.open sql,conn,1,3
if not rs.eof then
rs("now_name")=request("now_name")
rs("type")=request("type")
rs("now_spec")=request("now_spec")
rs("now_model")=request("now_model")
rs("now_amount")=request("now_amount")+rs("now_amount")
rs("unit")=request("unit")
rs("now_price")=request("now_price")
rs("now_total")=request("now_price")*(request("now_amount")+rs("now_amount"))
rs("now_beizhu")=Server.HTMLEncode(request.Form("now_beizhu"))
rs("now_lbuyer")=request("now_lbuyer")
rs("last_indate")=request("last_indate")
rs("add")=request("add")
rs("now_manager")=request("now_manager")
rs.update
rs.close
conn.close
set rs=nothing
response.write "<script language='javascript'>" & chr(13)
response.write "alert('asdf 功!');" & Chr(13)
response.write "window.document.location.href='nowmaterial_manage.asp';"&Chr(13)
response.write "</script>" & Chr(13)
Response.End
else
rs.addnew
rs("now_name")=request("now_name")
rs("type")=request("type")
rs("now_spec")=request("now_spec")
rs("now_model")=request("now_model")
rs("now_amount")=request("now_amount")
rs("unit")=request("unit")
rs("now_price")=request("now_price")
rs("now_total")=request("now_amount")*request("now_price")
rs("now_beizhu")=Server.HTMLEncode(request.Form("now_beizhu"))
rs("now_lbuyer")=request("now_lbuyer")
rs("last_indate")=request("last_indate")
rs("add")=request("add")
rs("now_manager")=request("now_manager")
rs.update
rs.close
conn.close
set rs=nothing
response.write "<script language='javascript'>" & chr(13)
response.write "alert('该物资入库登记成功!');" & Chr(13)
response.write "window.document.location.href='nowmaterial_manage.asp';"&Chr(13)
response.write "</script>" & Chr(13)
Response.End
%>
<%end if%>
作者:
('葒諺禍氺
时间:
2009-12-27 03:32
if rs.recordcount < 1 then
rs.addnew
else
rs("now_name")=request("now_name")
.
.
.
rs.update
end if
欢迎光临 新微赢技术网 (http://bbs.weiying.cn/)
Powered by Discuz! X3.2