公司产品.asp只能直接从数据表里获取的
帮看看,我这样写的话,没提示什么错误,但产品就没有显示出来...
用 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>
请问那我把这改为嵌套循环,直接在一个页面显示公司和相应某公司的产品,该怎么改?
<body leftmargin="0" topmargin="0">
<p>
<table width="260" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr class="topbg">
<td colspan="8"><table width="100%" height="172" border="0" cellpadding="0" cellspacing="1">
<%
set rs=server.createobject("adodb.recordset")
dim sql
sql="select * from baojianpin order by date DESC"
if request.QueryString("type")<>"" then
sql="select * from baojianpin order by date DESC"
end if
page=request.querystring("page")
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=int(page)
rs.open sql,conn,3,1
if rs.eof then
%>
<tr>
<td height="24" colspan="2">
<div align="center"><font color="#FF0000" size="3">暂时没有记录!</font></div> </td>
</tr>
<%
response.end
else
rs.pagesize=12
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
i=0
dim id(),gongsi(),tupian()
do while not rs.eof and (i<rs.pagesize)
i=i+1
redim preserve id(i),gongsi(i),tupian(i)
id(i)=rs("id")
gongsi(i)=rs("gongsi")
tupian(i)=rs("tupian")
rs.movenext
loop
end if
rs.close
%>
<tr>
<%for i = 1 to ubound(id)%>
<td HEIGHT="140">
<a href="baojianpinxx.asp?id=<%=id(i)%>" target="_blank">
<img border="1" src="
<%
if trim(tupian(i))="" then
response.Write("images/none.jpg")
else
response.Write(trim(tupian(i)))
end if
%>
" width="100" height="100"></a><br><div align="center" class="STYLE4"><br>
<a href="baojianpinxx.asp?id=<%=id(i)%>" target="_blank">
<%=left(gongsi(i),8)%></a></div></td>
<td HEIGHT="140">
<iframe border="0" frameborder="0" noresize scrolling="no" width="160" height="120"
src="../baojianpin/chanpin_list1.asp"></iframe>
</td>
<%a=a+1%>
<%if a>2 then %>
</tr>
<tr>
<%a=0%>
<%end if%>
<%next%>
</tr>
</table></td>
</tr>
</table>
<p>
<%
set rs=nothing
conn.close
set conn=nothing
%>
</p>
</p></body>