公司产品.asp只能直接从数据表里获取的
这是在公司列表页面中给公司名称加的连接,这样就可以把公司的名称通过地址传递到公司产品.asp页中
<A href="公司产品.asp?gongsi=<%=left(gongsi(i),8)%>"><%=left(gongsi(i),8)%></a>
在公司产品.asp中接收参数gongsi的值作为关键字查询:
sql="select * from baojianpin where gongsi='"& request("gongsi") &"' order by date DESC"
request("gongsi")是接收从网页中传递来的值
帮看看,我这样写的话,没提示什么错误,但产品就没有显示出来...
用 response.Write(sql) response.End()输出sql语句结果是:
select * from baojianpin where gongsi=''order by date DESC
也就是公司的值没有获取到,该怎么做?
<!--#include file="conn.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style3 {color: #000000;
font-size: 9px;
}
.style4 {color: #000000}
-->
</style>
<style type="text/css">
<!--
body {
background-image:
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<style type="text/css">
<!--
.style2 {font-size: 14px}
body,td,th {
color: #333333;
}
a:link {
color: #333333;
text-decoration: none;
}
a:visited {
color: #666666;
text-decoration: none;
}
a:active {
color: #FF3300;
text-decoration: none;
}
a:hover {
text-decoration: none;
color: #3399FF;
}
.STYLE5 {font-size: 12px}
.STYLE8 {font-size: 16px}
-->
</style>
</head>
<body>
<p>
<table align="center" width="500" height="234" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
dim id(),gongsi(),tupian()
redim preserve id(i),gongsi(i),chanpin(i)
set rs=server.createobject("adodb.recordset")
sql="select * from baojianpin where gongsi='"&gongsi(i)&"'order by date DESC"
'response.Write(sql)
'response.End()
rs.open sql,conn,1,1
%>
<td align="left" valign="top"><table width="100%" border="0" align="center" cellpadding="0"
cellspacing="0" class="border">
<!--DWLayoutTable-->
<tr class="topbg">
<td height="48"><div align="left"></div>
<table width="499" height="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<% if rs.eof then %>
<tr>
<td width="410" height="200"><div align="center" class="STYLE5">
<font size="1">暂时没有产品!</font></div></td>
</tr>
<%
response.end
else
rs.pagesize=6
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
i=0
do while not rs.eof and (i<rs.pagesize)
i=i+1
id(i)=rs("id")
gongsi(i)=rs("gongsi")
tupian(i)=rs("tupian")
rs.movenext
loop
end if
rs.close
%>
<tr>
<div align="left">
<td height="20" align="left" class="STYLE5">·<a href="baojianpinxx.asp?id=<%=rs("id")%>"
target="_blank">
<%=left(chanpin(i),8)%>
</a>
</td>
</div>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<%
set rs=nothing
conn.close
set conn=nothing
%>
</p>
</body>