标题:请问这个查询如何写?
只看楼主
webserr
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2014-9-27
结帖率:0
已结贴  问题点数:10 回复次数:2 
请问这个查询如何写?
有一个案例的详细介绍页面,caseshow.asp   案例分类大分类名为:bigclassname  二级分类名为:smallclassname  详细内容页的其它字段是 title    我在大分类下建立了“雪铁龙案例” 然后直接在大分类下添加了这个案例的内容,案例的标题也是 "雪铁龙案例一",  然后在大分类 "雪铁龙案例" 在建立一个二级分类“雪铁龙案例一”,再在这个二级分类下添加了五篇细分的介绍。     我现在需要在案例的最终展示页面上  同事调用 五篇二级分类的文章标题,请问怎么操作?查询语名如何写?

下面是案例展示页的代码:



<!--#include file="Inc/SysProduct.asp" -->
<%
MaxPerPage=MaxPerPage_Default
strFileName="business.asp?BigClassName=" & BigClassName & "&SmallClassName=" & SmallClassName
%>
<%
ShowSmallClassType=ShowSmallClassType_Article
dim ID
ID=trim(request("ID"))
if ID="" then
    response.Redirect("business.asp")
end if

sql="select * from Product where ID=" & ID & ""
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
if rs.bof and rs.eof then
    response.write"<SCRIPT language=JavaScript>alert('找不到此案例!');"
  response.write"javascript:history.go(-1)</SCRIPT>"
else   
    rs("Hits")=rs("Hits")+1
    rs.update
%>

<%
function cutstr(tempstr,tempwid)
if len(tempstr)>tempwid then
cutstr=left(tempstr,tempwid)&"..."
else
cutstr=tempstr
end if
end function%>


<%
title=request("title")
%>










<table width="960" border="0" align="center" cellpadding="0" cellspacing="0" background="16/40.jpg">
                        
                        <tr>
                          <td height="249" colspan="2" valign="top" style="line-height:25px; padding-top:1px;"><table width="740" border="0" cellspacing="0" cellpadding="0">
                              
                        
                              
                              <tr>
                                <td height="1" colspan="2"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                                    <tr>
                                      <td height="50" valign="top"><%=rs("Content")%></td>
                                    </tr>
                                </table></td>
                              </tr>
                              <tr>
                                <td
                  height="1" colspan="2" bgcolor="#CCCCCC"></td>
                              </tr>
                             
                          </table></td>
                          <td width="10" valign="top"><br /></td>
                          <td width="1" valign="top" bgcolor="#333333"></td>
                          <td width="3" valign="top"></td>
                          <td width="186" valign="top" bgcolor="0F1C2F"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td height="44"><table width="160" border="0" align="center" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td>&nbsp;</td>
                                      </tr>
                                    </table>
                                      <table width="160" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
                                      <tr>
                                        <td><img class="picbox" border="1" src="<%=rs("DefaultPicUrl")%>" width="160" height="100" /></td>
                                      </tr>
                                    </table></td>
                                  </tr>
                                </table>
                                <table width="160" border="0" align="center" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td height="37"><div align="center"><font color="#FFFFFF" size="2"> <%=rs("title")%> </font></div></td>
                                  </tr>
                                </table>
                                
                           
                                
                                <table width="160" border="0" align="center" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td height="37">
                                    
                                    
                                
                                    
                                    
                                      <table  border="0" cellspacing="0" cellpadding="0"  align="left" style="margin-top:4px;">
          <tbody>
            <%
            dim title
title=trim(request("title"))
set rs_news=server.createobject("adodb.recordset")
sqltext6="select top 10 * from product where  smallclassname='"& title &"' order by id desc"
rs_news.open sqltext6,conn,1,1                     
%>
            <%i=0
do while not rs_news.eof%>
            <tr >
              <td height="20" width="20" align="middle"><span style="color: #FF0000">.</span></td>
              <td  ><div align="left"><a href="caseShow.asp?id=<%=rs_news("id")%>" target="_blank"  ><%=cutstr(rs_news("title"),34)%></a> </div></td>
            
            </tr>
            <%rs_news.movenext
i=i+1
if i=10 then exit do
loop
rs_news.close %>
          </tbody>
</table>

                                    
                                    
                           
                           
                        
                           
                           
                           
                           
                           
                                    
                                    
                                    &nbsp;</td>
                                  </tr>
                                </table>
                              </td>
                        </tr>
                    </table>



<%
end if
rs.close
set rs=nothing
call CloseConn()
%>


新手只有20分,实在不好意思,谢谢!
搜索更多相关主题的帖子: 如何 文章 title 雪铁龙 include 
2014-09-27 15:16
tlliqi
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:204
帖 子:15453
专家分:65956
注 册:2006-4-27
得分:10 
这是什么语言
2014-09-27 16:39
webserr
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2014-9-27
得分:0 
asp
2014-09-27 18:52



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




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

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