asp sql 提速问题

来源:百度知道 编辑:UC知道 时间:2024/06/22 09:08:21
<%
dim hangye
hangye=request("hangye")
hangye2=request("hangye2")
set rs=server.CreateObject("adodb.recordset")
if request("hangye")<>"" then
exec="select * from bgclass1 where flage=0 and rclass="&request("hangye")&""
elseif request("hangye2")<>"" then
exec="select * from bgclass1 where flage=0 and rclass2="&request("hangye2")&""
end if
rs.open exec,conn,1,1
while(not rs.eof and not rs.bof)
title=rs("newstitle")
baogaoleixing=rs("baogaoleixing")
myjg=rs("pricen")
price=rs("price")
priced=rs("priced")
filename=rs("url")
gjcj=rs("gjcj")
cbrq=rs("cbrq")
pricee=rs("pricee")
gjc=rs("gjc")
gjc2=rs("gjc2")
leib=rs("rclass&q

'不使用创建记录集的办法.
'直接使用索引号本例中addtime,url,newstitle对应
rsl(0),rsl(1),rsl(2)

exec="select addtime,url,newstitle from bgclass1 where rclass="&leib&" and url<>'"&title&"' and (newstitle like '%"&gjc&"%' or newstitle like '%"&gjc2&"%') order by sortid desc"

Set Rsl=Conn.ExeCute(""&exec&"")
i=0
do while(not rsl.eof and i<20)
dated=month(rsl(0))&"/"&day(rsl(0))

sc.write"<li>• <a href="&syh&"../report/"&rsl(1)&""&syh&" title="&syh&""&rsl(2)&""&syh&">"&rsl(2)&"</a> <font class="&syh&"date"&syh&">("&dated&")</font></li>"&vbCrLf

rsl.movenext
i=i+1
loop
''
set rsl=nothing