不说其他,你的代码是否有问题,是很简单的问题 if not (rs.eof or rs.bof) then--表示不为空 conn.close set conn=nothing Response.Redirect "no.htm" Response.end ---这里的处理明显当成空 else--下面的出来可以吗?都为空,还可以取出 rs("Count")??? rs("Count")=rs("Count")+5 rs("SaveTime")=now() rs.update rs.close set rs=nothing end if end if conn.close set conn=nothing
楼上的说得很对。我再补充一点,你的if---else ---endif 后面多出了一个endif if not (rs.eof or rs.bof) then conn.close set conn=nothing Response.Redirect "no.htm" Response.end else rs("Count")=rs("Count")+5 rs("SaveTime")=now() rs.update rs.close set rs=nothing end if end if
你上面的代码也还有很多漏洞!修改 if rs.eof or rs.bof then rs.close --释放所有的资源 set rs = nothing conn.close --然后跳到没有记录提示页面 set conn=nothing Response.Redirect "no.htm" Response.end else rs("Count")=rs("Count")+5 rs("SaveTime")=now() rs.update rs.close set rs=nothing '如果下面不需要秀出结果,那么conn也可以释放 conn.close set conn = nothing'做成一个好习惯,只要不用,要显示释放资源,减轻服务器的负担 end if
if not (rs.eof or rs.bof) then--表示不为空
conn.close
set conn=nothing
Response.Redirect "no.htm"
Response.end ---这里的处理明显当成空
else--下面的出来可以吗?都为空,还可以取出 rs("Count")???
rs("Count")=rs("Count")+5
rs("SaveTime")=now()
rs.update
rs.close
set rs=nothing
end if
end if
conn.close
set conn=nothing
if not (rs.eof or rs.bof) then
conn.close
set conn=nothing
Response.Redirect "no.htm"
Response.end
else
rs("Count")=rs("Count")+5
rs("SaveTime")=now()
rs.update
rs.close
set rs=nothing
end if
end if
if rs.eof or rs.bof then
rs.close --释放所有的资源
set rs = nothing
conn.close --然后跳到没有记录提示页面
set conn=nothing
Response.Redirect "no.htm"
Response.end
else
rs("Count")=rs("Count")+5
rs("SaveTime")=now()
rs.update
rs.close
set rs=nothing
'如果下面不需要秀出结果,那么conn也可以释放
conn.close
set conn = nothing'做成一个好习惯,只要不用,要显示释放资源,减轻服务器的负担
end if
的写法会比你的快点,但是如果每天频繁的存取数据,那么是非常的慢 用sp当然会快点,因为用sp<只是把数据传过去,然后在服务器端执行,效率当然高很多 用sp写吧,速度快,如果用vb写成dll,速度也有提升,但是更新代码麻烦,因为要等用户不用时候把com停掉,更新! 不管用com还是sp,总之如果用的人多,就是同时很多人在往你的database存取数据,那么记住更新的代码写在begin transaction ...commit 里面,出错要回退,并且给用户提示,这些都是好习惯