标题:这段程序运行的很慢,有没经验丰富的老手看看。
只看楼主
yn136071
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2008-6-7
结帖率:100%
已结贴  问题点数:20 回复次数:1 
这段程序运行的很慢,有没经验丰富的老手看看。
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<%
if Request.Cookies("globalec")("globalecmaster")="" or Request.Cookies("globalec")("masterflag")="" then
response.write "<script language='javascript'>"
response.write"this.location.href='../login.asp';</SCRIPT>"
response.end
end if
%>
<link rel="stylesheet" type="text/css" href="../css/style.css">
            <script>
var checkflag="false";
function check(field){
if(checkflag=="false"){
for(i=0;i<field.length;i++){
field[i].checked=true;}
checkflag="true";
return "解除全选"; }
else {
for(i=0;i<field.length;i++) {
field[i].checked=false;}
checkflag="false";
return "选择全部";}}
</script>
<body>
<%
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim log_id
for i = 0 to ubound(idarr)
log_id=clng(idarr(i))
call deleteannounce(log_id)
next
else
call deleteannounce(clng(idlist))
end if
end if

if request("action")="" then
response.write "<script language='javascript'>"
response.write "alert('您提交的信息不符合规范!');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
end if

if Chkrequest(request("action")) then
action=request("action")
else
Response.Redirect ("/login/chklogin.asp?login=4")
end if

keywords=replace_text(request("keywords"))
%>
<%
sql1="select top 300 info.info_id,info.showname,info.picture,info.type,info.tuijian,info.gsid,info.flag,info.checkman,info.dateandtime,info.sortid,info.typeid,info.typeid_2,info.draw,corporation.flag as corflag,corporation.sortid from info,corporation "
sqlt=sqlt&"where corporation.id=info.gsid "
if action="0" then
if instr(Request.Cookies("globalec")("masterflag"),"51")=0 then
response.redirect "../err.asp"
response.end
end if
sqlt=sqlt&" and info.flag=0 and info.jinji=0 and corporation.flag<>1 and corporation.uflag=1 and info.sortid<>54"
end if
if action="1" then
if instr(Request.Cookies("globalec")("masterflag"),"52")=0 then
response.redirect "../err.asp"
response.end
end if
sqlt=sqlt&" and info.flag=1 and info.jinji=0 and corporation.flag=0  and corporation.uflag=1 and info.sortid<>54"
end if
if action="2" then
if instr(Request.Cookies("globalec")("masterflag"),"51")=0 then
response.redirect "../err.asp"
response.end
end if
sqlt=sqlt&" and info.flag=0 and info.jinji=0  and corporation.uflag=1 and info.info_leixing='二手'"
end if
if action="3" then
if instr(Request.Cookies("globalec")("masterflag"),"52")=0 then
response.redirect "../err.asp"
response.end
end if
sqlt=sqlt&" and info.flag=1 and info.jinji=0 and corporation.uflag=1 and info.info_leixing='二手'"
end if

if action="4" then
if instr(Request.Cookies("globalec")("masterflag"),"51")=0 then
response.redirect "../err.asp"
response.end
end if
sqlt=sqlt&" and info.flag=0 and info.jinji=0  and corporation.uflag=1 and info.info_leixing='维修保养'"
end if
if action="5" then
if instr(Request.Cookies("globalec")("masterflag"),"52")=0 then
response.redirect "../err.asp"
response.end
end if
sqlt=sqlt&" and info.flag=1 and info.jinji=0 and corporation.uflag=1 and info.info_leixing='维修保养'"
end if

if action="6" then
if instr(Request.Cookies("globalec")("masterflag"),"51")=0 then
response.redirect "../err.asp"
response.end
end if
sqlt=sqlt&" and info.flag=0 and info.jinji=0  and corporation.uflag=1 and info.sortid=55"
end if
if action="7" then
if instr(Request.Cookies("globalec")("masterflag"),"52")=0 then
response.redirect "../err.asp"
response.end
end if
sqlt=sqlt&" and info.flag=1 and info.jinji=0 and corporation.uflag=1 and info.sortid=55"
end if


if request("type")>"" then  sqlt=sqlt&" and type='"&request("type")&"'"
if keywords>"" then sqlt=sqlt&" and (showname like '%"&keywords&"%' or qymc like '%"&keywords&"%' or [user] like '%"&keywords&"%'  or checkman like '%"&keywords&"%')"

'版主权限控制
sqlt=changeSql(sqlt)
sqlt=replace(sqlt,"(sortid","(info.sortid")
sqlt=replace(sqlt," sortid"," info.sortid")
'sql=replace(sql," sortid"," info.sortid")
'sql=replace(sql," sortid"," info.sortid")

'统计记录条数
sqlct="select count(*) from info,corporation "&sqlt
rsnum=Conn.Execute(sqlct)
num=rsnum(0)
'结束
sqlt=sqlt&" order by dateandtime desc"
sql=sql1&sqlt
'response.Write sql
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
msg_per_page=20 '定义每页显示记录条数
%>
<!--#include file="../../inc/headpage.asp"-->
<table width="98%" border="0" cellspacing="0" cellpadding="0"  align=center class="tableBorder">
<tr>
<th class="tableHeaderText" colspan=2 height=25>普通会供求员管理</th>
</tr>
<tr>
<td class="forumRowHighlight" colspan=2><p><B>注意</B>:<BR><font color=red>①任何的删除操作都是不可逆的,执行删除时请慎重。</font><BR>
<font color=blue>②点击<font color=red>供求名称</font>查看或修改该条供求详细信息。</font>
<br><font color=blue>③点击<font color=red>公司名</font>查看或者修改用户"企业信息"。</font>
</td>
</tr>
<FORM name=searchForm action="select.asp" method=post>
<tr>
<td width="19%" height=25 class="forumRowHighlight">
<B>管理操作选项</B></td>
<td width="81%" class=forumRowHighlight>关键字:<input name="keywords" type="text" value="<%=keywords%>">
&nbsp;类型:
<select name="which">
              <option value="0" <%if action ="0" then Response.Write "selected"%>>待审普通会员供求</option>
              <option value="1" <%if action ="1" then Response.Write "selected"%>>已审普通会员供求</option>
              <option value="2">待审客客通会员供求</option>
              <option value="3">已审客客通会员供求</option>
              <option value="4">待审紧急求购</option>
              <option value="5">已审紧急求购</option>
        </select> <input type="submit" value="立刻查找" id=submit name=submit>   | [<a href="javascript:location.reload()">刷新页面</a>]
        </td>
</tr>
</form>
  <tr>
    <td height=25 colspan="2" class="forumRowHighlight">待审普通会员<a href="index.asp?action=0&type=卖"><font color=red>供应</font></a>/<a href="index.asp?action=0&type=买"><font color=red>求购</font></a> | 已审普通会员<a href="index.asp?action=1&type=卖"><font color=red>供应</font></a>/<a href="index.asp?action=1&type=买"><font color=red>求购</font></a> | 待审客客通会员<a href="admin_check.asp?action=0&type=卖"><font color=red>供应</font></a>/<a href="admin_check.asp?action=0&type=买"><font color=red>求购</font></a> | 已经审客客通会员<a href="admin_check.asp?action=1&type=卖"><font color=red>供应</font></a>/<a href="admin_check.asp?action=1&type=买"><font color=red>求购</font></a> | <a href="admin_check.asp?action=2"><font color=red>待审紧急求购</font></a>/<a href="admin_check.asp?action=3"><font color=red>已审紧急求购</font></a></td>
  </tr>
</table>
<br>
  <Form name="search" method="POST" action="index.asp?action=<%=action%>&keywords=<%=keywords%>&type=<%=request("type")%>">
  <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder">
    <tr>
        <th class="tableHeaderText" height=25>普通会员供求列表</th>
    
    <tr>
                <td>
  <TABLE width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolor="#111111" bordercolorlight="#D7EBFF" bordercolordark="#D7EBFF" style="border-collapse: collapse">
    <TBODY>
<%
if rs.eof then
response.Write"<br><br><div align='center'>暂无数据信息</div><br><br>"
else
%>
<TR height=25>
<TD width="236" height="20" class=bodytitle><font color="#CC3300"><b>供求标题</b></font></TD>
<TD width="75" class=bodytitle align=center><font color="#CC3300"><b>所属类型</b></font></TD>
      <TD width="261" class=bodytitle><font color="#CC3300"><b>发布公司</b></font></TD>
      <TD width="132" class=bodytitle><font color="#CC3300"><b>是否关键词推荐</b></font></TD>
      <TD width="70" class=bodytitle><font color="#CC3300"><b>发布时间</b></font></TD>
      <TD width="31" class=bodytitle align="center"><font color="#CC3300"><b>操作</b></font></TD>
      <TD width="32" class=bodytitle align="center"><font color="#CC3300"><b>审核人</b></font></TD>
      <TD width="51" align="center" class=bodytitle>
<%if instr(Request.Cookies("globalec")("masterflag"),"17")=0 then
response.Write"没有权限"
else%>

<input type='submit' value='删除' onClick="{if(confirm('您确定执行的操作吗?')){this.document.even.submit();return true;}return false;}">
<%end if%></TD>
</TR>
<%
'do while not rs.eof and rowcount > 0
ii=1
for ii=1 to rs.pagesize
if rs.eof then exit for
%>
<TR height="20">
<TD width="236" class=forumRow><a href=edit.asp?info_id=<%=rs("info_id")%>&gsid=<%=rs("gsid")%> target="_blank"><% Set re = New RegExp
re.Pattern ="("&keywords&")"
re.IgnoreCase = True
re.Global=True
result = rs("showname")%>>><%=result%></a>&nbsp;</td>
<TD width="75" class=forumRow align=center><%if rs("type")="卖" then%><a href="index.asp?action=<%=action%>&keywords=<%keywords%>&type=卖">供应</a><%end if%><%if rs("type")="买" then%><a href="index.asp?action=<%=action%>&keywords=<%keywords%>&type=买">求购</a><%end if%>
<%if rs("type")="二手设备" then%><a href="index.asp?action=<%=action%>&keywords=<%keywords%>&type=二手设备">二手设备</a><%end if%>
</td>
<TD width="261" class=forumRow><%
      set rs3=conn.execute("select top 1 id,[user],qymc from corporation where id="&rs("gsid")&"")
      response.write"<font color=FF0000>("&rs3("user")&")</font><a href='../Company/edit.asp?id="&rs3("id")&"'>"&rs3("qymc")&"</a>"
      %>

 </td>
<TD width="132" class=forumRow><% if rs("tuijian")=1 then %>
        <p align="center">
          <font color="#FF0000">已推荐</font>
          <%else%>
              <p align="center">  
                <font color="#008000">未推荐</font>
                <%end if%></td>
<TD width="70" class=forumRow><%=rs("dateandtime")%></td>
<TD width="31" align="center" class=forumRow><% if rs("Flag")=1 then %>
        <p align="center"> <a href="shenghe1.asp?info_id=<%=rs("info_id")%>&page=<%=CurrentPage%>&action=<%=action%>&type=<%=rs("type")%>&keyworlds=<%=keyworlds%>">
          <font color="#FF0000">已审核</font></a>
          <%else%>
              <p align="center"> <a href="shenghe.asp?info_id=<%=rs("info_id")%>&page=<%=CurrentPage%>&action=<%=action%>&type=<%=rs("type")%>&keyworlds=<%=keyworlds%>&cpmc=<%=rs("showname")%>">
                <font color="#008000">未审核</font></a>
                <%end if%>
            </td>
<TD width="32" align="center" class=forumRow>
<%if trim(rs("checkman"))="0" then%>
无记录
<%else%>
 <% Set re = New RegExp
re.Pattern ="("&keywords&")"
re.IgnoreCase = True
re.Global=True
result = re.Replace(rs("checkman"), "<font color=red>$1</font>")%>
              <%=result%>

<%end if%></td>
<TD width="51" align="center" class=forumRow><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("info_ID"))%>'></td>
</TR>
<%
icolor=icolor+1
if icolor>1 then icolor=0
rowcount=rowcount-1
rs.movenext
next
'loop
end if
%>
</TABLE>
</td>
    </tr>
              <tr><td class=forumRow><div align="right"><input type=button value=" 全部选定 " onClick="this.value=check(this.form)"></div></td></tr>
              <tr>
                <td class=forumrowHighLight  align="left"><b>友情提示:共有<font color="#FF0000"><%=num%></font>条记录,只显示前500条。为了减少数据库查询占用过多的服务器资源!</b></td>
              </tr>
              <tr>
                <td class=forumrowHighLight align="center"><b><%=listPages("index.asp?action="&action&"&keywords="&keywords&"&type="&request("type")&"")%></b></td>
              </tr>
</table>
</form>

<%

sub deleteannounce(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="delete from [info] where info_id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub
%>
<!--#include file="../copy.asp"-->
搜索更多相关主题的帖子: 老手 经验 运行 
2009-08-04 20:04
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:20 
如果不是数据量很大,有可能某段代码出现了无限循环。
2009-08-04 23:48



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




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

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