注册 登录
编程论坛 ASP技术论坛

麻烦帮我看一下这代码错在那里?

sydpoechang 发布于 2008-03-29 10:41, 1412 次点击
<form id="form1" name="form1" method="post" action="123.asp?ss=sfqx">
  <input type="submit" name="Submit" value="提交" />
</form>
<!--#include file="Conn1.asp" -->
<%
If Request.QueryString("ss")="sfqx" Then
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from JaAdmin where Userweb='公司注册'",conn1,1,3
if not rs1.eof then
do while not rs1.eof
rs1("qyclass")=3
rs1.movenext
loop
Response.Write "<script language=javascript>alert('修改成功!');window.document.location.href='123.asp';</script>"
else
end if
rs1.update
rs1.close
set rs1=nothing
end if
%>
能实现所有‘公司注册'的qyclass值得为3 但是~不能返回到123.asp
14 回复
#2
sydpoechang2008-04-03 09:12
ddddddddddd
#3
jamesxiaoyao2008-04-03 09:16
错误提示是什么
#4
jamesxiaoyao2008-04-03 09:18
你这张页面是修改页面 ?
#5
jamesxiaoyao2008-04-03 09:24
那就  
response.Redirect(123.asp )
#6
sydpoechang2008-04-03 11:33
呵呵 自己写的一个程序修改数据库因为现在不管是个人还是公司的值都是0 我想把 公司的qyclass这个值改成3,一个一个去改麻烦

提示

BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/cqsq123/123.asp, 第 14 行
#7
sydpoechang2008-04-03 11:34
<!--#include file="Conn1.asp" -->
<form id="form1" name="form1" method="post" action="123.asp?ss=sfqx">
  <input type="submit" name="Submit" value="提交" />
</form>
<%
If Request.QueryString("ss")="sfqx" Then
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from JaAdmin where Userweb='公司注册'",conn1,1,3
if not rs1.eof then
do while not rs1.eof
rs1("qyclass")=3
rs1.movenext
loop
rs1.update
rs1.close
set rs1=nothing
Response.Write "<script language=javascript>alert('修改成功!');window.document.location.href='123.asp';</script>"
end if
else
end if
%>

rs1.update是现在的14行
#8
天涯听雨2008-04-03 12:45
<form id="form1" name="form1" method="post" action="123.asp?ss=sfqx">
  <input type="submit" name="Submit" value="提交" />
</form>
<!--#include file="Conn1.asp" -->
<%
If Request.QueryString("ss")="sfqx" Then
   set rs1=server.CreateObject("adodb.recordset")
   rs1.open "select * from JaAdmin where Userweb='公司注册'",conn1,1,3

   if not rs1.eof then
     do while not rs1.eof
        rs1("qyclass")=3
        rs1.movenext
    loop
    Response.Write "<script language=javascript>alert('修改成功!');window.document.location.href='123.asp';</script>"
  else

  end if
  rs1.update
  rs1.close
  set rs1=nothing
end if
%>

改成:

<form id="form1" name="form1" method="post" action="123.asp?ss=sfqx">
  <input type="submit" name="Submit" value="提交" />
</form>
<!--#include file="Conn1.asp" -->
<%
If Request.QueryString("ss")="sfqx" Then
   set rs1=server.CreateObject("adodb.recordset")
   rs1.open "select * from JaAdmin where Userweb='公司注册'",conn1,1,3


  rs1("qyclass")=3    '请确定 qyclass 字段是数字类型字段

  rs1.update

  set rs1=nothing

  Response.Write "<script language=javascript>alert('修改成功!');window.location.href='123.asp';</script>"
end if
%>
#9
sydpoechang2008-04-05 09:16
天涯你这样只能修改一个
#10
madpbpl2008-04-05 12:56
if not rs1.eof then
     do while not rs1.eof
        rs1("qyclass")=3
        rs1.movenext
    loop
改成
if not (rs1.eof and rs1.bof)then
     do while not rs1.eof
        rs1("qyclass")=3
        rs1.movenext
    loop
试试这样
#11
sydpoechang2008-04-08 16:40
还是不行还是rs1.update这里出错
#12
hmhz2008-04-08 17:41
这样修改
<%
If Request.QueryString("ss")="sfqx" Then
conn.execute "update JaAdmin set qyclass=3 where Userweb='公司注册'"
Response.Write "<script>alert('所以记录已经修改成功!');location.href='123.asp';</script>"
end if
%>
#13
leaphs2008-04-08 19:06
其它不变修改一下rs1.update
的位置
<%
do while not rs1.eof
rs1("qyclass")=3
rs1.update
rs1.movenext
loop
%>
#14
sydpoechang2008-04-16 09:20
谢谢leaphs
1