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> <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>