跨页问题
发现首页要调用的文章编号数值无法传递给详细页面,首页新闻都是连接到数据库第一条纪录
首页部分代码
<td width="172" valign="top" bgcolor="#FFFFFF"><a href="xx.asp?cy=<%=rs("id")%>" class="style2"><%=rs("title")%></a> </td>
<td width="72" valign="top" bgcolor="#FFFFFF"><%=rs("dtime")%>
跨页显示详细内容代码
<%@ Language=VBScript %>
<%
dim idx
idx="1"
if (request("id") <> "") then
idx=request("id")
end if
%>
<%
dim connstr
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("bbs.mdb")
Set cn=Server.CreateObject("ADODB.Connection")
cn.Open connstr
%>
<%
exec="select * from bbs where id=" + idx
set rs=server.createobject("adodb.recordset")
rs.open exec,cn,1,1
%>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=gb2312">
<title>详细页面</title>
</head>
<body><center>
<table width="500" align="center">
<tr>
<td align="left" eidth="25%">标题</td>
<td align="left" eidth="25%">正文</td>
<td align="left" eidth="25%">作者</td>
<td align="left" eidth="25%">发表日期</td>
</tr>
<%
while (not rs.EOF)
%>
<tr>
<td align="left" eidth="25%"><%=rs("title")%></td>
<td align="left" eidth="25%"><%=rs("body")%></td>
<td align="left" eidth="25%"><%=rs("name")%></td>
<td align="left" eidth="25%"><%=rs("dtime")%></td>
</tr>
<tr>
<td align="left" eidth="25%"> </td>
<td align="left" eidth="25%"> </td>
<td align="left" eidth="25%"> </td>
<td align="left" eidth="25%"> </td>
</tr>
<tr>
<td align="left" eidth="25%"> </td>
<td align="left" eidth="25%"> </td>
<td align="left" eidth="25%"> </td>
<td align="left" eidth="25%"> </td>
</tr>
<%
rs.MoveNext()
Wend
%>
</table>
<p><a href="index3.asp">返回</p></center>
</body>
<%
rs.close()
set rs=nothing
%>
</html>