注册 登录
编程论坛 ASP技术论坛

[开源][讨论][求助]asp语句有一部分总是跳过

guaishi 发布于 2007-09-21 14:00, 1227 次点击

下面这段代码为什么总不执行跳转到 <a href="searchResult.asp?keywords=<%=rb("corpuser_info.username")%>"> <%=rb("corpuser_info.username")%></a> 这上一句请问如何改或

<table width="962" border="0" align="center" cellpadding="0" cellspacing="0" class="CONTENT" bgcolor="#FFFFFF">

<td width="960"></tr>
<tr>
<td height="24"><table width="778" border="0" cellspacing="0" cellpadding="0">
<tr>
<% 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
%>
<a href="searchResult.asp?keywords=<%=rb("corpuser_info.username")%>"> <%=rb("corpuser_info.username")%></a>
<%
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,1
%>
<a href="searchResult.asp?keywords=<%=rb("corpuser_info.username")%>"> <%=rb("corpuser_info.username")%></a>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="6%"><img src="images/arrow01.gif" width="9" height="12" align="absmiddle"></td>
<td width="94%"><a href="searchResult.asp?keywords=<%=rb("corpuser_info.username")%>"> <%=rb("corpuser_info.username")%></a>
</table>
<%else%>
<%set rs = server.CreateObject("adodb.recordset")
sql = "SELECT * FROM corp_producttype where parent="&id&""
rs.open sql,conn,1,3
%><%if rb.recordcount<>"" then
%>
<% if len(id)=2 or len(id)=4 then%>
<a href="producttype_list.asp?id=<%=rs("id")%>" class="link4"><%=rs("corp_producttype")%><%=rb.recordcount%><%response.write("公司")%></a></td>
<% do while not rs.eof %>


<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="6%"><img src="images/arrow01.gif" width="9" height="12" align="absmiddle"></td>
<td width="94%">
<%rs.movenext%>

<%loop%>
<% else%>
<%
response.redirect "searchResult.asp?keywords="&rb("corpuser_info.username")
%>


<%end if%>
<%end if%>
<% end if%>
<% end if%> </tr>

12 回复
#2
guaishi2007-09-23 16:06
回复:(guaishi)[开源][讨论][求助]asp语句有一部分...

怪石 15:56:26
其实我的那个程序是想实现这样的操作
有两个表一个分类表,记录分类的信息,有三级分类
另外是一个公司中选择产品的列表
公司可以任意思选取三项
现在想实现从分类中得到该类中有多少家公司选择了
并输出公司相关信息

怪石 15:57:30
公司选取的是一个数值编号对应分类表中的guanlian
怪石 15:58:40
我通过sql语句可以正常显示公司的数量
就是现在无法输出公司的信息那句输出语句不被调用呀
黒馬黃子 15:59:49
你意思是说guanlian字段里的内容和corpuser_info表里的三个字段做对比?
怪石 16:00:10
是的

怪石 16:00:23
他们的值是相同的
黒馬黃子 16:00:51
如果相同会怎样?不相同又怎样?
怪石 16:01:12
得到guanlian的值就可以得到公司选的主品名称
怪石 16:02:43
相同就记录公司有公司选取了这种产品/类
并想办法输出
通过类来输出所有选取所有满足条件的值
怪石 16:02:59
就是通过分类输出公司

黒馬黃子 16:05:38
<%=rb.recordcount%><%response.write("公司")%>
你这个是显示多少家公司?
怪石 16:06:04
是呀
可以正常显示的
现在想要输出公司的信息就出了问题

#3
madpbpl2007-09-23 19:34
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)"
上面这样写,下面却写成这样,你的id到底是什么类型?
sql = "SELECT * FROM corp_producttype where parent="&id&""
如果是自动编号,则上面改写成这样试试
sql="select * from corp_producttype,corpuser_info where corp_producttype.id="&id&" and corp_producttype.guanlian in(select jobFunction1,jobFunction2,Funtion3 from corpuser_info)"


#4
guaishi2007-09-24 09:15
sql数据库的不是自动编号的
#5
hmhz2007-09-24 09:22
你的问题不是已经解决了嘛
#6
guaishi2007-09-24 09:32

还没有呢
正在想办法

#7
guaishi2007-09-24 12:47
只有本站会员才能查看附件,请 登录

只有本站会员才能查看附件,请 登录

只有本站会员才能查看附件,请 登录

上面是执行显示的结果
不知道为什么就是不能跳转
#8
yms1232007-09-24 14:15
if rb.recordcount>0 then
这个属性应该是数字类型
而且楼主如果判断记录集是否为空
也可以写
if rb.eof then
另外跳转
用Response.Redirect "[URL地址]"
的方式在服务器端进行跳转
#9
guaishi2007-09-24 14:55

不明白你的意思在服务器跳转和客户端跳转没有什么不同呀

#10
yms1232007-09-24 15:02
if rb.recordcount>0 then
%>
<a href="searchResult.asp?keywords=<%=rb("corpuser_info.username")%>"> <%=rb("corpuser_info.username")%></a>
那楼主满足这个条件后继续执行后面的代码还是跳转到searchResult.asp页面?
#11
guaishi2007-09-24 22:01
回复:(yms123) if rb.recordcount>0 ...

两个都要执行可以吗
老板的要求是这样的
我也没有办法
结果它只执行了一个

#12
guaishi2007-09-25 06:54
主要是循环体
但是也要输出结果
#13
guaishi2007-10-08 09:16

现在我用别的办法实现了

1