将分页中的最新新闻嵌入主页为何不显示,急急急!!!

zjwxl2005 2005-04-16 02:52:05
偶刚开始学习ASP,便遇到了一个难题,请各路大侠赐教!
我在首页里想嵌入主页index.asp同一级目录下文件夹news里的最新信息,在127.0.0.1/news/index.asp中有最新信息呀?可是在主页总提示"对不起,暂无新闻!"
以下是我在主页里嵌入的语句:
<TD width="480" colspan="2"><!--#include file="news/shangping_tj.asp" --></TD>
请各位一定帮帮指点迷津!
...全文
129 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
tosflyor 2005-04-17
  • 打赏
  • 举报
回复
补充一下:include 包含的是代码而不是结果
tosflyor 2005-04-17
  • 打赏
  • 举报
回复
应该是数据库路径的问题,用include的时候最容易出现这种错误
zjwxl2005 2005-04-17
  • 打赏
  • 举报
回复
然后我用<iframe frameborder=0 height=190 marginheight=1
marginwidth=1 scrolling=no
src="netshop/shops0.asp"
width=313
bordercolor="#000000" name="I5"></iframe>
语句嵌入主页中,却发现如下错误提示.

HTTP 错误 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务

--------------------------------------------------------------------------------

技术信息(用于支持人员)

错误类型:
ADODB.Recordset (0x800A0BB9)
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/netshop/shops0.asp, 第 2 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)

网页:
GET /netshop/shops0.asp


以下是shop0.asp中的代码:

<%set rs=server.CreateObject("adodb.recordset")
rs.open "select Top 10 * from shjia where flag=2 order by adddate desc",conn,1,1
%>
<table width="580" border="0" cellspacing="0" cellpadding="0" align="center" class="table-zuoyou" bordercolor="#CCCCCC">
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select Top 20 * from shjia where tj>2 order by adddate desc",conn,1,1
%>
<td width="580" valign="top" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<table width="100%" border="0" align="center" cellSpacing="1" cellPadding="0" bgColor="#efefef">
<%
do while not rs.eof
%>
<tr>
<td width="25%" height="25" bgcolor="#FFFFFF"> <img src="images/ring01.gif" width="9" height="9">
<%response.write "<a href=user/index.asp?id="&rs("shjiaid")&" target=_blank>"
if len(trim(rs("name")))>10 then
response.write left(trim(rs("name")),8)&".."
else
response.write trim(rs("name"))
end if
response.write "</a>"
%>
<%rs.movenext%>
</td>
<td width="25%" height="25" bgcolor="#FFFFFF"> <img src="images/ring01.gif" width="9" height="9">
<%if rs.eof then%>
<%else%>
<%response.write "<a href=user/index.asp?id="&rs("shjiaid")&" target=_blank>"
if len(trim(rs("name")))>10 then
response.write left(trim(rs("name")),8)&".."
else
response.write trim(rs("name"))
end if
response.write "</a>"
%>
<%rs.movenext%>
<%end if%>
</td>
<td width="25%" height="25" bgcolor="#FFFFFF"> <img src="images/ring01.gif" width="9" height="9">
<%if rs.eof then%>
<%else%>
<%response.write "<a href=user/index.asp?id="&rs("shjiaid")&" target=_blank>"
if len(trim(rs("name")))>10 then
response.write left(trim(rs("name")),8)&".."
else
response.write trim(rs("name"))
end if
response.write "</a>"
%>
<%rs.movenext%>
<%end if%>
</td>
<td width="25%" height="25" bgcolor="#FFFFFF"> <img src="images/ring01.gif" width="9" height="9">
<%if rs.eof then%>
<%else%>
<%response.write "<a href=user/index.asp?id="&rs("shjiaid")&" target=_blank>"
if len(trim(rs("name")))>10 then
response.write left(trim(rs("name")),8)&".."
else
response.write trim(rs("name"))
end if
response.write "</a>"
%>
<%rs.movenext%>
<%end if%>
</td>
</tr>
<%loop
rs.close
set rs=nothing%>
</table></td>
</tr>
</table>
请各位指点迷津.
zjwxl2005 2005-04-17
  • 打赏
  • 举报
回复
<script language="JavaScript">
<!--
function demo(Page,scrl){
if (false)window.close();
if (!window.win || win.closed)
{
win=open(Page,"gouwu","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=2,width=450,height=350,scrollbars="+scrl+",resizable=1");
}
else{
win.close();
win=open(Page,"gouwu","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=2,width=450,height=350,scrollbars="+scrl+",resizable=1");
}
}
//-->
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center">
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select Top 8 * from shop_books where newsbook=1 order by bookid desc",conn,1,1
if rs.eof and rs.bof then
response.write "<center><br><font color=red size=2>对不起,暂无信息!</font></font>"
'response.End
else
%>

<table cellspacing=0 cellpadding=0 border=0 width="100%">
<%
dim i_1,i_count
i_1=int((rs.recordcount+1)/2)
if i_1>5 then
i_1=5
end if
'response.write i_1
for i_count=1 to i_1%>
<tr>
<td valign=top width="300">
<table cellspacing=0 cellpadding=0 width="100%">
<tr>
<td valign=top width="41%" style="PADDING-LEFT: 6px"><br>
<%if rs("bookpic")="" then
response.write "<div align=center><a href=list.asp?id="&rs("bookid")&" target=_blank><img src=images/emptybook.gif width=75 height=75 border=0></a></div>"
else%>
<div align="center"><a href=list.asp?id=<%=rs("bookid")%> target=_blank><img src="<%=trim(rs("bookpic"))%>" width=75 border=0 height="75" alt="<%=trim(rs("bookname"))%>"></a>
<%end if%>
</div>
</td>
<td valign=top width="59%"><a class=a4
href=list.asp?id=<%=rs("bookid")%> target=_blank><font color=#FF6600><br>
 </font></a><a href=list.asp?id=<%=rs("bookid")%> target=_blank>
<font color="#800000"> <u><strong>
<%if len(trim(rs("bookname")))>7 then
response.write left(trim(rs("bookname")),7)&".."
else
response.write trim(rs("bookname"))
end if%>
</strong></u> </font> </a><br>
 市场价:<s><%=formatnumber(rs("shichangjia"),2)&"元"%></s><br>
 会员价:<font color=#FF0000><%=formatnumber(rs("huiyuanjia"),2)&"元"%></font><br>
 VIP 价:<font color=#FF0000><strong><%=formatnumber(rs("Vipjia"),2)&"元"%></strong></font><br>
<font color="#999999">  </font>
<table cellpadding=0 cellspacing=0>
<tbody>
<tr>
<td> <a href="javascript:demo('gouwu.asp?id=<%=rs("bookid")%>&action=add');"><img src="images/goumai.gif" width="43" height="12" border=0></a><a href="javascript:;" onClick="javascript:window.open('shoucang.asp?id=<%=rs("bookid")%>&action=add','shouchang','width=450,height=350,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');"><img src="images/shoucang1.gif" width="49" height="13" border=0></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr align="right">
<td valign=top colspan="2" style="PADDING-LEFT: 6px"><font color="#999999"> 
</font> <font color="#999999">
<%rs.movenext%>
</font></td>
</tr>
</table>
</td>
<td valign=top width="1" background="images/bj_x1.gif"></td>
<td valign=top width="300">
<%if rs.eof then%>
 
<%else%>
<table cellspacing=0 cellpadding=0 width="100%">
<tr>
<td valign=top width="41%" style="PADDING-LEFT: 6px"><br>
<%if rs("bookpic")="" then
response.write "<div align=center><a href=list.asp?id="&rs("bookid")&" target=_blank><img src=images/emptybook.gif width=75 height=75 border=0></a></div>"
else%>
<div align="center"><a href=list.asp?id=<%=rs("bookid")%> target=_blank><img src="<%=trim(rs("bookpic"))%>" width=75 border=0 height="75" alt="<%=trim(rs("bookname"))%>"></a>
<%end if%>
</div>
</td>
<td valign=top width="59%"><a class=a4
href=list.asp?id=<%=rs("bookid")%> target=_blank><font color=#FF6600><br>
 </font></a><a href=list.asp?id=<%=rs("bookid")%> target=_blank>
<font color="#800000"> <strong><u>
<%if len(trim(rs("bookname")))>7 then
response.write left(trim(rs("bookname")),7)&".."
else
response.write trim(rs("bookname"))
end if%>
</u></strong> </font> </a><br>
 市场价:<s><%=formatnumber(rs("shichangjia"),2)&"元"%></s><br>
 会员价:<font color=#FF0000><%=formatnumber(rs("huiyuanjia"),2)&"元"%></font><br>
  VIP 价:<font color=#FF0000><strong><%=formatnumber(rs("Vipjia"),2)&"元"%></strong></font><br>
<font color="#999999">  </font>
<table cellpadding=0 cellspacing=0>
<tbody>
<tr>
<td> <a href="javascript:demo('gouwu.asp?id=<%=rs("bookid")%>&action=add');"><img src="images/goumai.gif" width="43" height="12" border=0></a><a href="javascript:;" onClick="javascript:window.open('shoucang.asp?id=<%=rs("bookid")%>&action=add','shouchang','width=450,height=350,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');"><img src="images/shoucang1.gif" width="49" height="13" border=0></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td valign=top colspan="2" style="PADDING-LEFT: 6px"><font color="#999999"> 
</font>
<%rs.movenext%>
</td>
</tr>
</table>
<%end if%>
</td>
</tr>
<tr>
<td valign=top colspan="3" background="images/bj_x1.gif" height="1"></td>
</tr>
<%next%>
<%
rs.close
set rs=nothing%>
</table>
<%end if%>
</td>
</tr>
</table>
coolbobo 2005-04-17
  • 打赏
  • 举报
回复
把连接数据库的代码贴出来
还有那个sshangping_tj.asp 的代码贴出来看看啊。
CXL_2005 2005-04-17
  • 打赏
  • 举报
回复
它要是提示了“对不起,暂无信息”说明你的数据库连接是好的,只是查询要么有问题,要么数据库中就没有记录。
如果连接错误,那么IE就报错的
zjwxl2005 2005-04-17
  • 打赏
  • 举报
回复
谢谢各位大侠高手的指导,我用的是ACCESS数据库,sshangping_tj.asp 的源程序里有"对不起,暂无新闻"这句话,而且sshangping_tj.asp这个文件只是几句代码。
coolbobo 2005-04-16
  • 打赏
  • 举报
回复
你打开sshangping_tj.asp 的源程序看看,里面有没有那个"对不起,暂无新闻"
有两种可能,你的数据库连接有问题。
还有就是你的sql语句有问题
仔细去看看
coolbobo 2005-04-16
  • 打赏
  • 举报
回复
查询语句有问题。
zjwxl2005 2005-04-16
  • 打赏
  • 举报
回复
news是主页目录下的一个子目录,要把最新新闻反映在主页上,当然要包括啰。在news这个主页中显示是正常的。
佛火 2005-04-16
  • 打赏
  • 举报
回复
可能是数据库路径的问题,,,你用Access???

佛火 2005-04-16
  • 打赏
  • 举报
回复
127.0.0.1/news/index.asp中有最新信息呀?可是在主页总提示"对不起,暂无新闻!"
以下是我在主页里嵌入的语句:
<TD width="480" colspan="2"><!--#include file="news/shangping_tj.asp" --></TD>
请各位一定帮帮指点迷津!


127.0.0.1/news/index.asp中有最新信息,那你干什么包含 news/shangping_tj.asp ??

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧