回答:菜鷹
學長
5月14日 01:48 謹供參考:
<!--#include file="conn.inc"-->
<% set dedao=request.form("id")
if dedao=0 then
response.redirect("tishi2.asp")
end if
%>
<!--#include file="conn2.asp"-->
<%
dim str() ''''''''''''''''''''(if: all=70 then:dim str(70))
ReDim str(1) ''''''''''''''''''''(if: all=70 then:去掉本句 )
dim all
set rs=conn.execute("select * from T_Key")
all=RS.RecordCount''''''''''''''''''''(all=70嗎?)
dim box1,id,id1,id2,str
box1="box"
for i=1 to all '''''''''''''''''(if: all=70 then:for i=1 to 70)
str(i)=request.form(id2)
ReDim Preserve str(i+1) '''''''''(if: all=70 then:去掉本句)
next
for i=1 to all '''''''''''''''(if: all=70 then:for i=1 to 70)
id1=rs("N_KeyId")
id2=box1&id1
'''''''''''''''''''''''''''''''''str=request.form(id2)
if str(i)="on" then
conn.execute("update T_Key set N_count=N_count+1 where N_KeyId="&id1)
end if
RS.MoveNext
next
id=request.form("id")
conn.execute("update T_Key set N_count=N_count+1 where N_KeyId="&id)
rs.close
set rs=nothing
conn.close
set conn=nothing
Response.Redirect("Result.asp")
%>
這樣改壹下,可能運行速度快壹點:
1)for.....next比Do While Not rs.eof.......loop快,因為後者每循環壹次都要判斷Not rs.eof是否為真--費時,前者不須,到循環次數就停--省時
2)把常量賦值box1="box" 放到循環外面,避免每次循環重新賦值,加速
3)id2=box1&id1 比id2=box1&rs("N_KeyId")快壹些
4)將request.form(id2)從“大循環”取出集中到“小循環”,減少“大循環”讀取數據的時間
思路:加快程序運行速度,避免“數據流”發生“堵塞”現象,希望有幫助
說明:1-如果記錄數與取樣數壹致為70,請註意修改程序註解處的語句(有助於加速的)
2-未見整體,只得議論壹“瘢”,不全面,恐誤見笑
******************
此處不再修改了,請看郵件吧
該回答在5月15日 00:39由回答者修改過