标题:在一個表查詢未結束時中間怎么樣能再加入一個查詢??
只看楼主
bxyl
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2007-10-14
 问题点数:0 回复次数:2 
在一個表查詢未結束時中間怎么樣能再加入一個查詢??
程序代码:
<!--#include file="conn.asp"-->
<!--#include file="admin/ubbhtml.asp"-->
<%
id=request("id")
if id="" then 
   response.write "参数不足"
   response.end
end if     
%> <%
sql="select * from learning where articleid="&id
rs.open sql,conn,1,2
if rs.bof or rs.eof then
   response.write "该内容已经不删除或者不存在"
   rs.close
   set rs=nothing
   conn.close
   set conn=nothing
   response.end
end if 
today=rs("today")

rs("todayhits")=rs("todayhits")+71
rs("hits")=rs("hits")+71
rs.update

if datediff("d",today,date)>=1 then
     rs("today")=date()
     rs("todayhits")=100
     rs.update
end if

title=rs("title")
hits=rs("hits")
writer=rs("writer")
if writer="" then
     writer=" if
url=rs("writer_url")
sort=rs("sort")
dateandtime=rs("dateandtime")
content=rs("content")
rs.close
response.write count
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www. saved from url=(0014)about:internet -->
<html xmlns="http://www. http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">td img {display: block;}body {
     margin-left: 0px;
     margin-top: -1px;
     margin-right: 0px;
     margin-bottom: 0px;
     background-color: #1A85D7;
}
body,td,th {
     font-size: 13px;
}
</style>
</head>
<body>

<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
   <td><img src="spacer.gif" width="75" height="1" border="0" alt="" /></td>
   <td><img src="spacer.gif" width="6" height="1" border="0" alt="" /></td>
   <td><img src="spacer.gif" width="76" height="1" border="0" alt="" /></td>
   <td><img src="spacer.gif" width="437" height="1" border="0" alt="" /></td>
   <td><img src="spacer.gif" width="6" height="1" border="0" alt="" /></td>
   <td><img src="spacer.gif" width="1" height="1" border="0" alt="" /></td>
  </tr>

  <tr>
   <td colspan="5" background="img/show_b.jpg"></td>
   <td><img src="spacer.gif" width="1" height="134" border="0" alt="" /></td>
  </tr>
  <tr>
   <td colspan="3" background="img/show_c.jpg"></td>
   <td colspan="2" align="center" background="img/show_d.jpg"><b><%=title%></b></td>
   <td><img src="spacer.gif" width="1" height="77" border="0" alt="" /></td>
  </tr>
  <tr>
   <td background="img/show_e.jpg"></td>
   <td background="img/show_f.jpg"></td>
   <td height="281" colspan="2" valign="top" bgcolor="#FFFFFF" style="line-height: 20px;"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
     <tr>
       <td height="279" colspan="2" valign="top"><span style="line-height: 20px;"><%=content%> </span></td>
     </tr>
     <tr>
       <td width="23%" height="20"> 发表:<%=writer%></td>
       <td width="77%" align="right">上篇:
         <%
sql="select * from learning where syxs<>0 and articleid="&id-1
rs.open sql,conn,1,2
if rs.bof or rs.eof then
   response.write "无"
   else
   response.write "<a href=show.asp?id="&id-1&">"&rs("title")&"</a>"
   end if 
rs.close    
%>
下篇:
<%
sql="select * from learning where syxs<>0 and articleid="&id+1
rs.open sql,conn,1,2
if rs.bof or rs.eof then
   response.write "无"
   else
   response.write "<a href=show.asp?id="&id+1&">"&rs("title")&"</a>"
   end if 
rs.close    
%>
  </td>
     </tr>
      <tr><td></td></tr>
   </table></td>
   <td background="img/show_h.jpg"></td>
   <td><img src="spacer.gif" width="1" height="301" border="0" alt="" /></td>
  </tr>
  
  <tr>
   <td colspan="5" background="img/show_i.jpg"></td>
   <td><img src="spacer.gif" width="1" height="21" border="0" alt="" /></td>
  </tr>
  <tr>
   <td colspan="5" background="img/show_j.jpg"></td>
   <td><img src="spacer.gif" width="1" height="39" border="0" alt="" /></td>
  </tr>
</table>
</body>
</html>
我怎么樣針下面這段代碼正確的加到上面的"<body>"的下面?(我直接加在下面就出錯!我想應該是几個查詢在一起有沖突,不知是不是這個原因)
程序代码:
<%
bost =lcase(request.servervariables("HTTP_HOST"))
set rs=Server.CreateObject("adodb.recordset")
sql ="select * from PPst_User where [WebURL] ='" &"http://"&bost & "'"
rs.open sql,conn,1,1
if not rs.eof then
%>
<%=rs("Qianming")%>
<%end if%>


[[italic] 本帖最后由 bxyl 于 2007-12-3 10:28 编辑 [/italic]]
搜索更多相关主题的帖子: 束時 response conn end 
2007-12-03 10:26
tianyu123
Rank: 1
等 级:新手上路
威 望:2
帖 子:576
专家分:0
注 册:2007-8-26
得分:0 
换一下记录集对象的名称
<%
bost =lcase(request.servervariables("HTTP_HOST"))
set rst=Server.CreateObject("adodb.recordset")
sql ="select * from PPst_User where [WebURL] ='" &"[url=http://]http://"&bost[/url] & "'"
rst.open sql,conn,1,1
if not rst.eof then
%>
<%=rst("Qianming")%>
<%end if%>

改变一切,须从改变观念开始!
2007-12-03 12:20
bxyl
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2007-10-14
得分:0 
非常感謝!!!!
2007-12-03 13:46



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




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

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