标题:Active Server Pages, ASP 0113 (0x80004005)
只看楼主
yangqihong
Rank: 1
来 自:内蒙古自治区
等 级:新手上路
帖 子:7
专家分:0
注 册:2009-8-2
结帖率:100%
已结贴  问题点数:20 回复次数:6 
Active Server Pages, ASP 0113 (0x80004005)
请大家指点我那里的错误呀:(Active Server Pages, ASP 0113 (0x80004005)
超过了脚本运行的最长时间。可以为 Server.ScriptTimeOut 属性指定新值或更改 IIS 管理工具中的相应值来更改此限制。)
代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% Option Explicit %>
<!-- 后台公告管理 -->
<!-- #include file="../config/db.asp" -->
<!-- #include file="../config/function.inc.asp" -->
<%
dim sql,rst,myErrors,page,pagelistnum,nowclass,fs,sqlfy
on error resume next
set fs=Server.CreateObject("scripting.FileSystemObject")
set rst=server.CreateObject("adodb.recordset")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>FIF VIP ASP教程后台管理--商品分类管理</title>
</head>
<body>
<%
'处理参数
pagelistnum=15'设置每页显示15件商品
if request.QueryString("page")="" then
  page=1
else
  page=request.QueryString("page")
end if
if session("admin_gcid")="" then session("admin_gcid")="0"
if request.QueryString("c")<>"" then session("admin_gcid")=request.QueryString("c")
if request.QueryString("act")="add" or request.QueryString("act")="update" then
%>
  <!-- #include file="../config/formdata.inc.asp" -->
<%
end if
'if request.querystring("act")<>"" and request.querystring("act")<>"modify" then
'if not isnumeric(request.querystring("id")) or isempty(request.querystring("id")) and request.QueryString("act")<>"add" then
'msgboxU "非法参数!"
'else

select case request.QueryString("act")
  case "add"'添加
      if formdata.item("f_name")<>"" and formdata.item("f_price")<>"" and IsNumeric(formdata.item("f_price")) then
      rst.open "tbl_goods",conn,1,3
      rst.addnew
      rst("gds_gcid")=formdata.item("f_gcid")
      rst("gds_name")=formdata.item("f_name")
      rst("gds_price")=formdata.item("f_price")
      rst("gds_jj")=formdata.item("f_jj")
      rst("gds_info")=formdata.item("f_info")
      rst("gds_img")=formdata.item("f_img")
      rst.update
      rst.close
     '如果上传了图片则删除
    if formdata.item("f_img")<>"" then fs.deletefile server.MapPath("../upfile") & "\" & formdata.item("f_img")
    end if
      errstr="添加记录"
      
  case "del"'删除
    if request.QueryString("id")="" then
      msgboxU "错误的参数"
    else
      sql="select count(*) as num from tbl_buy where buy_gdsid=" & request.QueryString("id")
      rst.open sql,conn,1,1
      if rst("num")>0 then
        msgboxU "此商品已经有人订购,您不能删除此商品"
      else
        sql="delete from tbl_goods where gds_id=" & request.querystring("id")
        conn.execute sql
       errstr="删除记录"
      end if
          end if

        case "update"'更新
            if request.QueryString("id")="" or formdata.item("f_name")="" or formdata.item("f_price")="" or not IsNumeric(formdata.item("f_price")) then
      msgboxU "错误的参数,或没有输入商品名或是商品价格,或价格不为数字"
    else
      sql="select * from tbl_goods where gds_id=" & request.QueryString("id")
      rst.open sql,conn,1,3
      rst("gds_name")=formdata.item("f_name")
      rst("gds_price")=formdata.item("f_price")
      rst("gds_jj")=formdata.item("f_jj")
      rst("gds_info")=formdata.item("f_info")
      '判断图片是否需要更新
      if formdata.item("f_img")<>"" then
        '如果原有图片则删除
        if rst("gds_img")<>"" then fs.deletefile server.MapPath("../upfile") & "\" & rst("gds_img")
        rst("gds_img")=formdata.item("f_img")
      end if
      rst.update
      rst.close
  errstr="更新记录"
  end if
  rst.close
    end select
set myerrors=conn.errors
if myerrors.count=0 then
msgboxU errstr&",成功!"
else
msgboxU errstr&",失败!原因:" &myerrors.item(0).description
end if
'end if
'end if
%>
<p>商品分类:
  <select name="select" onChange="javascript:location='admin_goods.asp?c='+this.value;">
    <option value="0" selected>所有商品</option>
    <%
sql="select * from tbl_goodsclass"
rst.open sql,conn,1,1
do while not rst.eof
%>
    <option value="<%=rst("gc_id")%>" <% if cint(session("admin_gcid"))=rst("gc_id") then
         response.Write(" selected")
         nowclass=rst("gc_name")'记录下当前分类名以便在新增商品时显示
       end if
       %>><%=rst("gc_name")%></option>
    <%
  rst.movenext
loop
rst.close
%>
  </select>
</p>
<table width="641" border="1" cellpadding="0" cellspacing="0">
  <tr align="center">
    <td width="62">ID</td>
    <td width="210">商品名</td>
    <td width="69">价格</td>
    <td width="188">分类</td>
    <td width="100">操作</td>
  </tr>
  <%
sql="select top " & (page*pagelistnum) & " * from tbl_goodsclass,tbl_goods where gds_gcid=gc_id"
sqlfy="select count(*) as num from tbl_goodsclass,tbl_goods where gds_gcid=gc_id"'翻页函数所需SQL语句
if cint(session("admin_gcid"))<>0 then'只显示选中的商品类别
  sql=sql & " and gc_id=" & session("admin_gcid")
  sqlfy=sqlfy & " and gc_id=" & session("admin_gcid")
end if
sql=sql & " order by gds_id"
rst.open sql,conn,1,1
rst.PageSize=pagelistnum
rst.AbsolutePage=page
do while not rst.eof
%>
  <tr>
    <td align="right"><%=rst("gds_id")%></td>
    <td><%=rst("gds_name")%></td>
    <td align="right"><%=rst("gds_price")%></td>
    <td align="center"><%=rst("gc_name")%></td>
    <td align="center"><a href="admin_goods.asp?act=modify&id=<%=rst("gds_id")%>">修改</a>&nbsp; <a href="admin_goods.asp?act=del&id=<%=rst("gds_id")%>" onClick="javascript:return confirm('您确定要删除此商品分类吗?');">删除</a> </td>
  </tr>
  <%
  rst.movenext
loop
rst.close
%>
  <tr>
    <td colspan="5" align="right"><%
    fy sqlfy,page,pagelistnum,"admin_goods.asp?t="
    %></td>
  </tr>
</table>
<br>
<br>
<%
'如果选择了某个分类才允许添加商品//如果是编辑也显示
if cint(session("admin_gcid"))<>0 or request.QueryString("act")="modify" then
%>
<form action="<%
      if request.querystring("act")="modify" then
        response.write "admin_goods.asp?act=update&id=" & request.querystring("id")
      else
        response.write "admin_goods.asp?act=add"
      end if
%>" method="post" enctype="multipart/form-data" name="frm">
  <table width="600" height="69" border="0" cellpadding="5" cellspacing="0">
    <tr>
      <td height="33" align="center"><%
      if request.querystring("act")="modify" then
        response.write "修改商品"
        sql="select * from tbl_goodsclass,tbl_goods where gds_gcid=gc_id and gds_id=" & request.QueryString("id")
        rst.open sql,conn,1,1
      else
        response.write "新增商品"
      end if
      %></td>
    </tr>
    <tr>
      <td>商品分类名:<%
      if request.QueryString("act")="modify" then
        response.Write rst("gc_name")
      else
        response.Write nowclass
      end if
      %> <input name="f_gcid" type="hidden" id="f_gcid" value="<%
      if  request.QueryString("act")="modify" then
        response.Write rst("gc_id")
      else
        response.Write session("admin_gcid")
      end if
        %>"></td>
    </tr>
    <tr>
      <td>品名:
      <input name="f_name" type="text" id="f_name" value="<% if request.QueryString("act")="modify" then response.Write(rst("gds_name")) %>"></td>
    </tr>
    <tr>
      <td>价格:      
      <input name="f_price" type="text" id="f_price" value="<% if request.QueryString("act")="modify" then response.Write(rst("gds_price")) %>" size="20"></td>
    </tr>
    <tr>
      <td>简介:
      <input name="f_jj" type="text" id="f_jj" value="<% if request.QueryString("act")="modify" then response.Write(rst("gds_jj")) %>" size="50"></td>
    </tr>
    <tr>
      <td>说明:
        <textarea name="f_info" cols="40" rows="5" id="f_info"><% if request.QueryString("act")="modify" then response.Write(rst("gds_info")) %> </textarea></td>
    </tr>
    <tr>
      <td>图片:
      <input name="f_img" type="file" id="f_img">
      <% if request.QueryString("act")="modify" then
        if rst("gds_img")<>"" then %><img src="<%=server.mappath("upfile") & "\" & rst("gds_img")%>">
        <%
          end if
        end if %>
      新增时如果没有可以不上传,修改时若不修改图片可不上传</td>
    </tr>
    <tr>
      <td><input type="submit" name="Submit" value="<%
      if request.QueryString("act")="modify" then
        response.Write "修改商品"
        rst.close
      else
        response.Write "新增商品"
      end if
      %>"></td>
    </tr>
  </table>
</form>
<%
end if'新增或修改商品END
%>
<%
set rst=nothing
conn.close
set conn=nothing
%>

</body>
</html>
搜索更多相关主题的帖子: Active Pages Server ASP 
2009-08-02 22:06
孤独冷雨
Rank: 10Rank: 10Rank: 10
来 自:安徽滁州
等 级:贵宾
威 望:23
帖 子:1246
专家分:1909
注 册:2007-6-4
得分:20 
你你的循环可能出错了,最简单的排除就是从最后往前删,一点一点来,看把哪一段代码删了后页面能打开!

这里有男女系列成人用品,有时间兄弟们来看一看.
51za.
2009-08-03 08:46
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
得分:0 
死循环
2009-08-03 09:16
yangqihong
Rank: 1
来 自:内蒙古自治区
等 级:新手上路
帖 子:7
专家分:0
注 册:2009-8-2
得分:0 
回复 楼主 yangqihong
孤独冷雨你好:
请您帮我看一下下面的问题?
我在渲染本页提示我为如下:

技术信息(用于支持人员)
 
错误类型:
Microsoft VBScript 编译器错误 (0x800A040E)
'loop' 语句缺少 'do'
/admin/admin_goods.asp, line 150
loop



本页代码如下:

133   <p>商品分类:
134     <select name="upid1" id="upid1" onChange="javascript:location='admin_goods.asp?c='+this.value;">
135       <option value="0" selected>==所有商品==</option>
136       <%
137   sql="select * from tbl_goodsclass where gds_gcid=0 "
138   rst.open sql,conn,1,1
139   do while not rst.eof  
 
140     sql1="select * from tbl_goodsclass,tbl_goods where gds_gcid=" & rst("gc_id")
141     rst1.open sql1,conn,1,1
142     do while not rst1.eof  
144    %>
145       <option value="<%=rst1("gc_id")%>" <% if cint(session("admin_gcid"))=rst1("gc_id") then  
146            response.Write("selected")  
147          %>><%=rst("gc_name")%>--><%=rst1("gds_name")%></option>
148       <%
149            rst1.movenext
150            loop  
151            rst1.close
152       rst.movenext
153       loop  
154      rst.close
155       %>
156      </select>
157    </form></p>

????
2009-08-07 15:33
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
133   <p>商品分类:  
134     <select name="upid1" id="upid1" onChange="javascript:location='admin_goods.asp?c='+this.value;">  
135       <option value="0" selected>==所有商品==</option>  
136       <%  
137   sql="select * from tbl_goodsclass where gds_gcid=0 "  
138   rst.open sql,conn,1,1  
139   do while not rst.eof   
         sql1="select * from tbl_goodsclass,tbl_goods where gds_gcid=" & rst("gc_id")  
141      rst1.open sql1,conn,1,1  
142      do while not rst1.eof   
145         With Response
               .Write "<option value="&rst1("gc_id")
               if cint(session("admin_gcid"))=rst1("gc_id") then   
146               .Write "selected >"   
147               .Write rst("gc_name")&"-->&"rst1("gds_name")
                  .Write "</option>"  
               End IF            
            End With
149         rst1.movenext  
150      loop   
151      rst1.close  
152      rst.movenext  
153   loop   
154   rst.close  
155       %>  
156      </select>  
157    </form></p
把代码的格式和缩进好好整整,不注意格式一会儿缺少end if一会儿又少loop,这些都是不注意格式的后果。
编写代码养成缩进和整齐的好习惯很重要,最好不要一行写N长的代码。
2009-08-07 17:32
myosotis
Rank: 5Rank: 5
等 级:职业侠客
帖 子:72
专家分:377
注 册:2009-8-4
得分:0 
145       <option value="<%=rst1("gc_id")%>" <% if cint(session("admin_gcid"))=rst1("gc_id") then   
146            response.Write("selected")   
147          %>><%=rst("gc_name")%>--><%=rst1("gds_name")%></option>  

缺少End if 如果不想要End if,请把第146行写在145行后面,不要换行,然后再测试

花自漂零水自流,一种相思,两处闲愁
2009-08-07 18:14
yangqihong
Rank: 1
来 自:内蒙古自治区
等 级:新手上路
帖 子:7
专家分:0
注 册:2009-8-2
得分:0 
回复 5楼 yms123

格式怎么写呀,,请指教(我是初学者)!!!!!
2009-08-08 08:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-281370-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033106 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved