| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2509 人关注过本帖
标题:这个查询语句怎么写?
只看楼主 加入收藏
webserr
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2014-9-27
结帖率:0
收藏
已结贴  问题点数:20 回复次数:7 
这个查询语句怎么写?
有一个案例的详细介绍页面,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分,实在不好意思,谢谢!
搜索更多相关主题的帖子: 雪铁龙 include title 文章 file 
2014-09-27 10:45
webserr
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2014-9-27
收藏
得分:0 
因为我二级分类的名称就是大分类下的案例名称,所以我直接  smallclassname='"& title &"'  但也识别不了
2014-09-27 10:55
tlliqi
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:204
帖 子:15453
专家分:65956
注 册:2006-4-27
收藏
得分:20 
提示是什么
2014-09-27 17:21
webserr
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2014-9-27
收藏
得分:0 
没提示,就是查询不出所要求的
2014-09-27 19:26
webserr
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2014-9-27
收藏
得分:0 
<%=rs("title")%>   
sqltext6="select top 10 * from product where  smallclassname='"& title &"' order by id desc"  

 我现在就是这一步不知如何操作,把 <%=rs("title")%>  作为一个变量
2014-09-27 21:26
webserr
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2014-9-27
收藏
得分:0 
怎么没人回复,都放假了啊
2014-09-27 21:27
webserr
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2014-9-27
收藏
得分:0 
有点小明白了,两个title 我是想让他赋不同的值,但实际上查询出的还是同一个标题,这个要怎么弄呢
2014-09-27 21:59
ljkmj4712389
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2014-11-6
收藏
得分:0 
开发工程师】 上海知名O2O互联网公司招聘开发工程师,工作地点闵行莘庄附近【长期招聘】
有意者联系:
QQ:1839371325
邮箱:newmount@
2014-11-06 16:20
快速回复:这个查询语句怎么写?
数据加载中...
 
   



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

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