循环update数据库,只能修改第一条,无错误提示.
这段代码是循环update数据库里的内容,可我发现每次只能改第一条记录.这段代码有什么问题吗,并没有出现错误提示.set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
constr="Provider=SQLOLEDB;Data Source=HZSQL01;Initial Catalog=HRDB;User ID=ReadWrite;Password=WriteRead"
conn.open = constr
rs.open "select * from Lease_equip where badge ='"&owner&"' and active=2",conn,1,1
do while not rs.eof
autoid = rs("autoid")
active="select"&rs("autoid")
comments = "test"&rs("autoid")
active = Cint(request.form(active))
comments = trim(request.form(comments))
'response.write active
set temprs=server.createobject("adodb.recordset")
sql = "update Lease_equip set active = '"&active&"',comments= '" &comments & "',disabledate = '"&disabledate&"' where autoid ='" & AutoID &"'" temprs.open sql,con,1,3
'response.write sql
temprs.close
set temprs = nothing
con.close
set con = nothing
rs.movenext
Loop
rs.close
set rs = nothing
conn.close
set conn= nothing