函数里面不能使用循环,哪位高手指点一下,内有代码

allonkwok 2006-05-20 09:15:55
Private Sub CreateSortingHtml()
If CLng(Request.Form("StartID")) > CLng(Request.Form("EndID")) Then
Response.Write ("<script>alert('对不起!你输入的开始ID比结束ID大,请重新输入。');history.go(-1)</script>")
Exit Sub
End If
Response.Write "<b><font color=""#FF0000""> 正在生成下载分类列表的HTML页, 此操作可能要持续几分钟,请稍候......</font></b><BR>" & vbCrLf
Response.Write "<table width=""400"" border=""0"" cellspacing=""1"" cellpadding=""1"">" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td bgcolor=000000>" & vbCrLf
Response.Write " <table width=""400"" border=""0"" cellspacing=""0"" cellpadding=""1"">" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td bgcolor=ffffff height=9><img src=""images/bar9.gif"" width=0 height=16 id=img2 name=img2 align=absmiddle></td></tr></table>" & vbCrLf
Response.Write "</td></tr></table></td></tr><tr> " & vbCrLf
Response.Write "<td align=center bgcolor=000000> <span id=txt2 name=txt2 style=""font-size:9pt"">0</span><span style=""font-size:9pt"">%</span> <span id=txt3 name=txt3 style=""font-size:9pt"">0</span></td></tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
Response.Flush
Dim totalnumber, Rs, SQL, i
Set Rs = Server.CreateObject("adodb.recordset")
If Request("seid") = 1 Then
SQL = "select sortid,SortName,SoftNum from [NC_softsort] where sortid >= " & Request.Form("StartID") & " and sortid <= " & Request.Form("EndID") & ""
Else
If Request("type") = "all" Then
SQL = "select sortid,SortName,SoftNum from [NC_softsort] order by sortid asc"
Else
SQL = "select sortid,SortName,SoftNum from [NC_softsort] where isUpdate = 1 order by sortid asc"
End If
End If
Rs.Open SQL, Conn, 1, 1
If Rs.EOF And Rs.bof Then
Response.Write "Sorry!没有找到任何分类。或者分类没有更新!"

Else
totalnumber = Rs.recordcount
i = 1
response.Write("<br>"&totalnumber&"<br>")
response.Write(i&"<br>")
Do While Not Rs.EOF
CreateSortList Rs("sortid"), Request("order")
Response.Write "<script>img2.width=" & Fix((i / totalnumber) * 400) & ";" & vbCrLf
Response.Write "txt2.innerHTML=""生成进度:" & FormatNumber(i / totalnumber * 100, 2, -1) & """;" & vbCrLf
Response.Write "txt3.innerHTML=""  共有分类 <B><font color=RED>" & totalnumber & "</font></B> 个  正在生成第 " & i & " 个"";" & vbCrLf
Response.Write "img2.title=""(" & i & ")"";</script>" & vbCrLf
Response.Flush
Response.Write "<table cellpadding=0 cellspacing=0 border=0 width=90% align=center><tr><td colspan=2 class=forumrow>  生成软件分类列表 [" & Rs(1) & "] 完成; 共有软件 [" & Rs(2) & "] 个。</td></tr></table>"
Response.Flush
Rs.movenext
i = i + 1
response.Write(i&"<br>")
Loop
End If
Rs.Close
Set Rs = Nothing
Response.Write "<script>img2.width=400;txt2.innerHTML=""100"";</script>"
Response.Write "<meta http-equiv=""refresh"" content=""1;url='?num=" & totalnumber & "&D=" & d & "&order=" & Request("order") & "&type=ok'"">"

...全文
208 7 打赏 收藏 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
浙外 2006-05-21
  • 打赏
  • 举报
回复
呵呵。搞笑了。
allonkwok 2006-05-20
  • 打赏
  • 举报
回复
找了半天,问题出在这里

CreateSortList Rs("sortid"), Request("order")

这个函数里面不能自己创建文件夹,所以后面都没执行,我创建了相应的目录后可以了

谢谢各位了,我继续测试中.....
什么都不能 2006-05-20
  • 打赏
  • 举报
回复
第一,写出你的出错信息,如果有的话就是程序有错误,没有的话就是逻辑有错误。
allonkwok 2006-05-20
  • 打赏
  • 举报
回复
有谁知道吗,谢谢了~,头真大了
allonkwok 2006-05-20
  • 打赏
  • 举报
回复
正在生成下载分类列表的HTML页, 此操作可能要持续几分钟,请稍候......


0% 0
181
1


这个是在DO WHILE 前面写的rs.RECORDCOUNT 和变量 i的数值 ,是有执行的,就是到DO WHILE这一步时就不执行了

失效就是没有执行,呵呵
浙外 2006-05-20
  • 打赏
  • 举报
回复
你可以先在DO WHILE 循环前加两句调试一句,分别是:
response.write "将要进入循环体"
response.write rs(2)
然后看有没有输出,如果两个都有输出相信是没问题的,
如果只有第一个输出没有第二个输出相信是没数据
如果两个输出都没有那就表示前面的IF根本没通过。呵呵

最后问下你的失效的意思是什么???
allonkwok 2006-05-20
  • 打赏
  • 举报
回复
这个是函数中的循环部分,函数有被调用,但到这个循环的时候就失效,我换成FOR 也没办法循环,

Do While Not Rs.EOF
CreateSortList Rs("sortid"), Request("order")
Response.Write "<script>img2.width=" & Fix((i / totalnumber) * 400) & ";" & vbCrLf
Response.Write "txt2.innerHTML=""生成进度:" & FormatNumber(i / totalnumber * 100, 2, -1) & """;" & vbCrLf
Response.Write "txt3.innerHTML=""  共有分类 <B><font color=RED>" & totalnumber & "</font></B> 个  正在生成第 " & i & " 个"";" & vbCrLf
Response.Write "img2.title=""(" & i & ")"";</script>" & vbCrLf
Response.Flush
Response.Write "<table cellpadding=0 cellspacing=0 border=0 width=90% align=center><tr><td colspan=2 class=forumrow>  生成软件分类列表 [" & Rs(1) & "] 完成; 共有软件 [" & Rs(2) & "] 个。</td></tr></table>"
Response.Flush
Rs.movenext
i = i + 1
response.Write(i&"<br>")
Loop

28,402

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧