| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 330 人关注过本帖
标题:求助ASP问题,其中一项数据无法读取
只看楼主 加入收藏
mianrong
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-10-28
收藏
 问题点数:0 回复次数:1 
求助ASP问题,其中一项数据无法读取

<%
Dim Rs
dim postcs
postcs="ht="&request("ht")
dim sql
set rs=server.createobject("adodb.recordset")
dim rsjg,sqljg
set rsjg=server.createobject("adodb.recordset")

Sql = "Select * From Net_cpbj where ht=0 order by id desc"

OpenConn
rs.open sql,conn,1,1
%>
<script language="JavaScript">
var NowDate='<%=Date()%>';
var Trade=new Array();

file://GoCo
function Goco(SMT_id)
{
window.open("Co.asp?ID="+SMT_id);
}
</script>

<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="743" height="160" valign="top" bgcolor="#FFFFFF"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="1" bgcolor="#FFFFFF"></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="1" cellspacing="0" background="img/searchb.gif">
<tr>
<form name="form1" method="post" action="search1.asp">
<td height="29"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="5%">&nbsp;</td>
<td width="6%"><div align="center"><img src="img/fdj.gif" width="21" height="21"></div></td>
<td width="12%"><div align="center">产品报价</div></td>
<td width="26%"><input name="ph" type="text" id="ph"></td>
<td width="15%"><div align="center">请输关键字:</div></td>
<td width="22%"><input name="keyword" type="text" id="keyword" size="15"></td>
<td width="18%"><input type="submit" name="Submit" value="搜索"></td>
</tr>
</table></td>
</form>
</tr>
</table>
<%

if rs.eof then
%>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="44">还没有报价</td>
</tr>
</table>
<%
else
const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim pagename
pagename="sca_tlist2.asp"
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if

'总的记录数
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if

'防止最后一页记录为空,比如共397条记录,每页40条,当为最后一页(10)时,就会需要如此判断
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if

if currentPage=1 then
showContent
showpage totalput,MaxPerPage,pagename
else

if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
showContent
showpage totalput,MaxPerPage,pagename

else

currentPage=1
showContent
showpage totalput,MaxPerPage,pagename
end if
end if
rs.close


'显示函数
sub showContent
i=1
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<tr align="center" bgcolor="#EEEEEE">
<td width="97" height="27" background="beijing/6.gif" bgcolor="#9C0000"><span class="style1">名称/牌号</span></td>
<td width="110" background="beijing/6.gif" bgcolor="#9C0000"><span class="style1">生产厂家</span></td>
<td width="55" background="beijing/6.gif" bgcolor="#9C0000"><span class="style1">价格</span></td>
<td width="62" background="beijing/6.gif" bgcolor="#9C0000"><span class="style1">数量</span></td>
<td width="58" background="beijing/6.gif" bgcolor="#9C0000"><span class="style1">交货地</span></td>
<td width="82" background="beijing/6.gif" bgcolor="#9C0000"><span class="style1">现/期</span></td>
<td width="78" background="beijing/6.gif" bgcolor="#9C0000"><span class="style1">发布日期</span></td>
<td width="192" background="beijing/6.gif" bgcolor="#9C0000"><span class="style1">发布公司</span></td>
</tr>
<%
dim gsname
do while not rs.eof and (i<MaxPerPage+1)
%>
<tr align="center" bgcolor="#EEEEEE">
<td width="97" height="27"><%=rs("ph")%></td>
<td width="110"><%=rs("cj")%>&nbsp;</td>
<td width="55"><%=rs("jg")%> </td>
<td width="62"><%=rs("sl")%>吨</td>
<td width="58"><%=rs("jhd")%></td>
<td width="82"><%=rs("xq")%></td>
<td width="78"><%=rs("fbrq")%></td>
<%
OpenConn2
sqljg="select SMT_id from SMT_yp where coname='"&rs("fbgs")&"'"
'response.write sqljg
rsjg.open sqljg,conn2,1,1
gsname=rsjg("SMT_id")
rsjg.close
%>
<td width="192"><div align="left"><a href="co.asp?ID=<%=gsname%>" target="_blank"><%=rs("fbgs")%></a></div></td>
</tr>
<%
i=i+1
rs.movenext
loop
%>
</table>
<%
end sub
end if%>
<%
'分页函数

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
if n>1 then
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="22" bgcolor="#ffffff">&nbsp;</td>
</tr>
<form action="<%=filename%>?<%=postcs%>" method="get">
<tr>
<td height="22" bgcolor="#eeeeee" color="#333333">&nbsp;&nbsp;
<%if CurrentPage<2 then %>
首页 上一页&nbsp;
<% else %>
<a href="<%=filename%>?page=1&<%=postcs%>">首页</a> <a href="<%=filename%>?page=<%=CurrentPage-1%>&<%=postcs%>">上一页</a>
<%end if
if n-currentpage<1 then %>
下一页 尾页
<% else %>
<a href="<%=filename%>?page=<%=CurrentPage+1%>&<%=postcs%>">下一页</a>
<a href="<%=filename%>?page=<%=n%>&<%=postcs%>">尾页</a>
<% end if
response.write "&nbsp;页次:<strong>"&CurrentPage&"/"&n&"</strong>页 "
response.write "&nbsp;共<b>"&totalnumber&"</b>条信息 <b>"&maxperpage&"</b>条信息/页 "
response.write " &nbsp;转到:<input class=smallInput type='text' name='page' size=4 maxlength=10 value="&currentpage&">"
response.write "<input type='submit' value='Goto' name='cndok'></span>"


%>
</td>
</tr>
</form>
</table>
<br> <br>
<%
else
%>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="22" bgcolor="#ffffff">&nbsp;</td>
</tr>
</table>
<%
end if
end function
%>
</td>
</tr>
</table>


其中:

运行后,fbgs无法读取

去除其中对fbgs的定义:

<%
OpenConn2
sqljg="select SMT_id from SMT_yp where coname='"&rs("fbgs")&"'"
'response.write sqljg
rsjg.open sqljg,conn2,1,1
gsname=rsjg("SMT_id")
rsjg.close
%>

fbgs能读取,但读取不出fbgs的ID

高手帮忙看看,问题出在什么地方呀?

[此贴子已经被作者于2006-10-28 12:09:04编辑过]

搜索更多相关主题的帖子: ASP 数据 
2006-10-28 12:07
MicroSoft
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:2
帖 子:499
专家分:3
注 册:2006-10-12
收藏
得分:0 
都换成select *测试一下

[glow=255,green,2]相信微软,相信我!~[/glow]
2006-10-28 12:53
快速回复:求助ASP问题,其中一项数据无法读取
数据加载中...
 
   



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

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