显示新闻的代码,完全复制了两遍,分别都能运行,就是合在一起不行,什么原因阿???强烈求助!!!
<!--#include file="conn.asp"-->
<!--#include file="conn1.asp"-->
<% dim rs, sql, rs1, sql1,sql3,sql2,rs2,rs3
set rs = server.createobject("adodb.recordset")
set rs1 = server.createobject("adodb.recordset")
set rs2 = server.createobject("adodb.recordset")
set rs3 = server.createobject("adodb.recordset")
%>
<%
'新闻类别
sql = "SELECT * FROM category"
rs.open sql, conn, 1, 1
if err.number <> 0 then
response.write "数据库出错"
else
if rs.bof and rs.eof then
rs.close
response.write "没有类别"
else
do while not rs.eof
response.write " <table width='400' border=0 cellspacing=0 cellpadding=0 height=25><tr><td valign=top height=25 width='160'> "
response.write " <table width='100%' border=1 cellspacing=0 cellpadding=0 height=25 bordercolorlight=#43445C bordercolordark=#FFFFFF><tr><td width='40%' height=17> </td> <td valign=middle bgcolor=#43445C height=17><div align=""center""><img src=""images/go.gif"" width=10 height=9><font color=#CCCCCC>" & rs("title") & "</font><a name="& rs("title") & "></a></div></td></tr></table>"
response.write "</td><td valign=bottom height=25 width=240><img src=""images/line.gif"" width='100%' height=1></td></tr></table>"
'本类别新闻标题
sql1 = "SELECT id,title,addtime FROM news WHERE cateid=" & rs("id") & " ORDER BY Cast(addtime As DateTime) DESC"
rs1.open sql1, conn, 1, 1
if err.number <> 0 then
response.write "数据库出错"
else
if rs1.bof and rs1.eof then
rs1.close
response.write "没有新闻"
else
dim i
response.write "<table width='100%' border=0 cellspacing=0 cellpadding=0 height=15>"
for i = 1 to FIRSTNO
response.write "<tr valign=middle><td height=20><img src=""images/red.gif"" width=5 height=12></td><td><a href='shownews.asp?id=" & rs1("id") & "' target='_blank'>" & rs1("title") & "( " & rs1("addtime") & " )</a></td></tr>"
rs1.movenext
if rs1.eof then exit for
next
rs1.close
response.write "<tr><td colspan=2 align=right><a href='category.asp?cate=" & rs("id") & "' target='_blank'><img src=""images/icon_more.gif"" width=80 height=20 border=0></a></td></tr>"
response.write "</table>"
end if
end if
rs.movenext
loop
rs.close
end if
end if
%>
<%
set rs1 = nothing
set rs = nothing
conn.close
set conn=nothing
%>
<%
'新闻类别
sql2= "SELECT * FROM category"
rs2.open sql2, conn1, 1, 1
if err.number <> 0 then
response.write "数据库出错"
else
if rs2.bof and rs2.eof then
rs2.close
response.write "没有类别"
else
do while not rs2.eof
response.write " <table width='400' border=0 cellspacing=0 cellpadding=0 height=25><tr><td valign=top height=25 width='160'> "
response.write " <table width='100%' border=1 cellspacing=0 cellpadding=0 height=25 bordercolorlight=#43445C bordercolordark=#FFFFFF><tr><td width='40%' height=17> </td> <td valign=middle bgcolor=#43445C height=17><div align=""center""><img src=""images/go.gif"" width=10 height=9><font color=#CCCCCC>" & rs2("title") & "</font><a name="& rs2("title") & "></a></div></td></tr></table>"
response.write "</td><td valign=bottom height=25 width=240><img src=""images/line.gif"" width='100%' height=1></td></tr></table>"
'本类别新闻标题
sql3= "SELECT id,title,addtime FROM news WHERE cateid=" & rs2("id") & " ORDER BY Cast(addtime As DateTime) DESC"
rs3.open sql3, conn1, 1, 1
if err.number <> 0 then
response.write "数据库出错"
else
if rs3.bof and rs3.eof then
rs3.close
response.write "没有新闻"
else
dim i
response.write "<table width='100%' border=0 cellspacing=0 cellpadding=0 height=15>"
for i = 1 to FIRSTNO
response.write "<tr valign=middle><td height=20><img src=""images/red.gif"" width=5 height=12></td><td><a href='shownews.asp?id=" & rs3("id") & "' target='_blank'>" & rs3("title") & "( " & rs3("addtime") & " )</a></td></tr>"
rs3.movenext
if rs3.eof then exit for
next
rs3.close
response.write "<tr><td colspan=2 align=right><a href='category.asp?cate=" & rs2("id") & "' target='_blank'><img src=""images/icon_more.gif"" width=80 height=20 border=0></a></td></tr>"
response.write "</table>"
end if
end if
rs2.movenext
loop
rs2.close
end if
end if
%>
<%
set rs2 = nothing
set rs3 = nothing
conn1.close
set conn1=nothing
%>