郁闷了一天了,还没有搞定,高手来帮我看看这段代码。
url=request.form( "url ")
if url= " " then
url= "class.asp "
end if
OrderID=request.form( "OrderID ")
ors=split(OrderID, ", ")
ors1=ubound(ors)
set rs=server.createobject( "adodb.recordset ")
sql= "select count(*) as Rscount from bigclass "
rs.open sql,connstr,1,3
RsCount=rs( "rscount ")
rs.close
response.write OrderID
if ors1+1=RsCount then
sql= "select * from bigclass order by orderid "
rs.open sql,connstr,1,3
if not rs.eof then
for i =1 to rscount
rs( "OrderID ")=ors(i-1)
rs.update
rs.movenext
next
end if
rs.close
else
response.write " <script language= 'javascript '> alert( '请将表单填写完整。 ');window.location= 'javascript:history.back() '; </script> "
end if
response.write " <script language= 'javascript '> alert( '更新成功。 ');window.location= ' "&url& " '; </script> "
set rs=nothing
conn.close
set conn=nothing
上边的代码是我更新分类排序的代码,在access中是执行正常的,在msde中提示更新成功,实际结果却就是没有更新,经过检测,问题就出在rs.update这里,我就不懂,这句我用了N年的语句在这咋就不管用了。
以下代码是我的数据库连接代码
'================================================================================================================
Dim ConnStr,conn
connStr= "Provider=SQLOLEDB.1; Persist Security Info=True; Data Source=127.0.0.1; Initial Catalog=kfzj; User ID=sa; Password=sa "
'On Error Resume Next
Set conn = Server.CreateObject( "ADODB.Connection ")
conn.open ConnStr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。 " '注释,需要把这几个字翻译成英文。
Response.End
End If
------解决方案--------------------access中的某些字段在sql中是不一样的如果这段代码在acess 中测试成功的话应该不会是代码的错误哦,看一下数据的类型
------解决方案--------------------会不会有数据为空啊,或是说下这里具体功能做了些什么呢
------解决方案--------------------是不是权限问题啊
------解决方案--------------------数据修改完毕后再更新看看
sql= "select * from bigclass order by orderid "
rs.open sql,connstr,1,3
if not rs.eof then
for i =1 to rscount
rs( "OrderID ")=ors(i-1)
rs.movenext
next
rs.update
else
response.write "nodate "
end if
rs.close