
关于ASP网页调取问题?
谁帮我看看下边的代码哪里错了,我的目的是网页标题调取新闻题目,我修改后标题是自动调取文章题目了,可是文章内容不显示了。(解决问题在加分30分)<!--#includefi...
谁帮我看看下边的代码哪里错了,我的目的是网页标题调取新闻题目,我修改后标题是自动调取文章题目了,可是文章内容不显示了。(解决问题在加分30分)
<!--#include file="inc/syscode.asp"-->
<%
dim id,nr,bt,hits
if request("articleid")<>"" then
articleid=request("articleid")
else
response.Redirect("index.asp")
end if
set rs=server.createobject("adodb.recordset")
sqltext="select * from product where articleid = "&articleid
rs.open sqltext,conn,1,3
if not rs.eof then
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=rs("title")%></title>
<link href="css.css" rel="stylesheet" type="text/css">
<!-- #include file="cd.asp" --></head>
<body>
<table width="940" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="67" class="ct"><table height="67" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="86%"> </td>
<td width="14%" class="top"><a href="index.asp">中文</a> English</td>
</tr>
</table></td>
</tr>
<tr>
<td height="12"></td>
</tr>
<tr>
<td><table width="560" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="ct2" onMouseOver="this.className='ct3'" onMouseOut="this.className='ct2'"><a href="AboutUs.asp">关于畅拓</a></td>
<td class="ct3" >产品&系统</a></td>
<td class="ct4" onMouseOver="this.className='ct5'" onMouseOut="this.className='ct4'"><a href="index.asp"><a href="news.asp">新闻&新品发布</a></td>
<td class="ct2" onMouseOver="this.className='ct3'" onMouseOut="this.className='ct2'"><a href="xxfb.asp">信息反馈</a></td>
<td class="ct2" onMouseOver="this.className='ct3'" onMouseOut="this.className='ct2'"><a href="zxns.asp">招贤纳士</a></td>
<td class="ct2" onMouseOver="this.className='ct3'" onMouseOut="this.className='ct2'"><a href="lxwm.asp">联系我们</a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="20"> </td>
</tr>
</table>
<table width="940" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<!-- #include file="include/cp.asp" -->
<td width="40" valign="top"><div align="center"><img src="img/line.jpg" width="11" height="520" /></div></td>
<td valign="top" class="ct11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="font-size:13px; color:#333; " height="40"><b><%=rs("title")%></b></td>
</tr>
<tr>
<td style="font-size:12px; color:#666666; letter-spacing:1.5px; line-height:150%; padding:10px 10px 10px;"><%=rs("content")%></td>
</tr>
<tr>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table><%
end if
rs.close
set rs=nothing
%>
<!-- #include file="include/footer.asp" --> 展开
<!--#include file="inc/syscode.asp"-->
<%
dim id,nr,bt,hits
if request("articleid")<>"" then
articleid=request("articleid")
else
response.Redirect("index.asp")
end if
set rs=server.createobject("adodb.recordset")
sqltext="select * from product where articleid = "&articleid
rs.open sqltext,conn,1,3
if not rs.eof then
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=rs("title")%></title>
<link href="css.css" rel="stylesheet" type="text/css">
<!-- #include file="cd.asp" --></head>
<body>
<table width="940" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="67" class="ct"><table height="67" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="86%"> </td>
<td width="14%" class="top"><a href="index.asp">中文</a> English</td>
</tr>
</table></td>
</tr>
<tr>
<td height="12"></td>
</tr>
<tr>
<td><table width="560" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="ct2" onMouseOver="this.className='ct3'" onMouseOut="this.className='ct2'"><a href="AboutUs.asp">关于畅拓</a></td>
<td class="ct3" >产品&系统</a></td>
<td class="ct4" onMouseOver="this.className='ct5'" onMouseOut="this.className='ct4'"><a href="index.asp"><a href="news.asp">新闻&新品发布</a></td>
<td class="ct2" onMouseOver="this.className='ct3'" onMouseOut="this.className='ct2'"><a href="xxfb.asp">信息反馈</a></td>
<td class="ct2" onMouseOver="this.className='ct3'" onMouseOut="this.className='ct2'"><a href="zxns.asp">招贤纳士</a></td>
<td class="ct2" onMouseOver="this.className='ct3'" onMouseOut="this.className='ct2'"><a href="lxwm.asp">联系我们</a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="20"> </td>
</tr>
</table>
<table width="940" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<!-- #include file="include/cp.asp" -->
<td width="40" valign="top"><div align="center"><img src="img/line.jpg" width="11" height="520" /></div></td>
<td valign="top" class="ct11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="font-size:13px; color:#333; " height="40"><b><%=rs("title")%></b></td>
</tr>
<tr>
<td style="font-size:12px; color:#666666; letter-spacing:1.5px; line-height:150%; padding:10px 10px 10px;"><%=rs("content")%></td>
</tr>
<tr>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table><%
end if
rs.close
set rs=nothing
%>
<!-- #include file="include/footer.asp" --> 展开
4个回答
展开全部
你的文章标题显示了,说明数据库打开没问题,数据至少成功到
<title><%=rs("title")%></title>
不知道你的cp.asp是什么网页,是不是有rs.close代码,试着把
<!-- #include file="include/cp.asp" -->删除试一下。
另外判断Eof就可以了
<title><%=rs("title")%></title>
不知道你的cp.asp是什么网页,是不是有rs.close代码,试着把
<!-- #include file="include/cp.asp" -->删除试一下。
另外判断Eof就可以了
展开全部
我觉得,最好直接定义两个变量,sTitle,sContent,
<%
dim id,nr,bt,hits
if request("articleid")<>"" then
articleid=request("articleid")
else
response.Redirect("index.asp")
end if
set rs=server.createobject("adodb.recordset")
sqltext="select * from product where articleid = "&articleid
rs.open sqltext,conn,1,3
if not rs.eof then
sTitle = rs("title")
sContent = rs("content")
rs.close
%>
在网页要显示数据的地方用 <%=sTitle%>,<%=sContent%>显示,你在下面引用的文件很可能把rs给关闭了,没看到其他的代码,不好说
<%
dim id,nr,bt,hits
if request("articleid")<>"" then
articleid=request("articleid")
else
response.Redirect("index.asp")
end if
set rs=server.createobject("adodb.recordset")
sqltext="select * from product where articleid = "&articleid
rs.open sqltext,conn,1,3
if not rs.eof then
sTitle = rs("title")
sContent = rs("content")
rs.close
%>
在网页要显示数据的地方用 <%=sTitle%>,<%=sContent%>显示,你在下面引用的文件很可能把rs给关闭了,没看到其他的代码,不好说
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
懒得看了,随随便看下发现你居然只判断了Eof没有判断Bof!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用ID 作为判断条件 最好
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询