asp的rs.update

一般的修改可以使用sql语句或者rs.update来提交

当需要循环修改时,不需要rs.update,比较奇怪

下面是一个统一个产品,不同录入时间的的数量循环减少

sqlstr="select  * from pro_style where style_pid="&rs_produit("id")&" and style_color='"&nowcolor&"' and style_size='"&nowsize&"' and style_num>0 order by style_id asc"

set  rsup=server.CreateObject("adodb.recordset")
rsup.open sqlstr,conn,1,3
tempnum=-1
tempshulian=10

do while not rsup.eof and not rsup.eof
  if tempnum>-1 then exit do
  tempnum=rsup("style_num")-tempshulian
 
   if tempnum<0 then
     '如果这条数量不够减
  tempshulian=tempshulian-rsup("style_num")
     rsup("style_num")=0
 
   else
    '数量够减或有多
    rsup("style_num")=tempnum
   end if
 
  rsup.movenext
loop
 'rsup.update
rsup.close
set rsup=nothing

 

posted @ 2010-05-24 11:47  Ethan_村长  阅读(2870)  评论(0编辑  收藏  举报