标题:[求助]asp分类查询并关联查询问题
取消只看楼主
guaishi
Rank: 1
等 级:新手上路
帖 子:156
专家分:0
注 册:2007-6-15
结帖率:100%
 问题点数:0 回复次数:1 
[求助]asp分类查询并关联查询问题

<%id=request("corp_producttype.id")
set rs = server.CreateObject("adodb.recordset")
if len(id)=2 then
sql = "SELECT corp_producttype.id,corp_producttype.corp_producttype,corp_producttype.gunlian,corpuser_info.jobFunction1,corpuser_info.jobFunction2,corpuser_info.jobFunction3,corpuser_info.username FROM corp_producttype,corpuser_info WHERE corp_producttype.id like'"&id&"%'and corp_producttype.guanlian in(corpuser_info.jobFunction1,corpuser_info.jobFunction2,corpuser_info.jobFunction2) groupy by corp_producttype.id='"&left(id,2)&"'"
end if
if len(id)=4 then
sql="SELECT corp_producttype.id,corp_producttype.corp_producttype,corp_producttype.gunlian,corpuser_info.jobFunction1,corpuser_info.jobFunction2,corpuser_info.jobFunction3,corpuser_info.username FROM corp_producttype,corpuser_info WHERE corp_producttype.id like'"&id&"%'and corp_producttype.guanlian in(corpuser_info.jobFunction1,corpuser_info.jobFunction2,corpuser_info.jobFunction2) groupy by corp_producttype.id='"&left(id,4)&"'"
end if
if len(id)=6 then
sql="SELECT corp_producttype.id,corp_producttype.corp_producttype,corp_producttype.gunlian,corpuser_info.jobFunction1,corpuser_info.jobFunction2,corpuser_info.jobFunction3,corpuser_info.username FROM corp_producttype,corpuser_info WHERE corp_producttype.id like'"&id&"%'and corp_producttype.guanlian in(corpuser_info.jobFunction1,corpuser_info.jobFunction2,corpuser_info.jobFunction2) groupy by corp_producttype.id='"&left(id,6)&"'"
end if
rs.open sql,conn,1,3
%>
<%if not rs.eof then%> <table width="778" border="0" cellspacing="0" cellpadding="0" align="center">

<tr>
<td height="30" align="left"><span class="font4">&gt;&gt;<a href="changping.asp?id=<%=rs("corp_producttype.id")%>&username=<%rs("corpuser_info.username")%>" class="link1"><%response.write("选取了")%><%=rs("corp_producttype")%><%=rs.recordcount%><%response.write("家公司")%><%response.write("公司名为")%><%=rs("corpuser_info.username")%></a></span></td>
</tr>
<%rs.movenext%>

<% end if %>
</table>

<table width="778" border="0" cellspacing="0" cellpadding="0" align="center">
<td class=LEADERAD align=middle><img src="../../img/framework/blank_spacer.gif" width="8" height="6"><br>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="728" height="90">
<param name="movie" value="../../img/2006-8-316-41-24_1.swf">
<param name="quality" value="high">
<embed src="../../img/2006-8-316-41-24_1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="728" height="90"></embed>
</object></td>
</tr>
</table></td>
</tr>
</table>

搜索更多相关主题的帖子: corp producttype info asp 
2007-09-20 11:11
guaishi
Rank: 1
等 级:新手上路
帖 子:156
专家分:0
注 册:2007-6-15
得分:0 
<% set rb=server.createobject("adodb.recordset")
id=request("id")
sql="select * from corp_producttype,corpuser_info where corp_producttype.id='"&id&"' and corp_producttype.guanlian in(corpuser_info.jobFunction1,corpuser_info.jobFunction2,corpuser_info.jobFunction3)"
rb.open sql,conn,1,1
if rb.recordcount="" then
rb.recordcount=0
end if

%> 这是分类部分实现了
还有一个关联查询表问题代码如上所示不能得到想要的结果
<%
id=request("id")
if len(id)=6 then%>
<%set rs = server.CreateObject("adodb.recordset")
sql = "SELECT * FROM corp_producttype where parent="&id&""
rs.open sql,conn,1,3
%>

网络改变了我,编程改变了我的生活
2007-09-20 16:08



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




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

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