<!--#include File="ConnDB.asp"-->
<html>
<head>
<title>查看新闻</title>
<meta HTTP-EQUIV="Content-topic" content="text/html; charset=gb2312">
<link href="style.css" rel="stylesheet">
<script language="JavaScript">
function newwin(url) {
  var wth=window.screen.width; 
  var hth=window.screen.heigth;
  var lefth,topth;
  if(wth==1024)
{
  hth=500;
  lefth =147;
  wth=550;
  topth=44;
}
  else if(wth==800)
{
  hth=500;
  lefth =35;
  wth=500;
  topth=10;
}
  else
{
  hth=500;
  wth=500;
}
  var oth="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left="+lefth+",top="+topth;
  oth = oth+",width="+wth+",height="+hth ;
  var newwin=window.open(url,"newwin",oth);
   newwin.focus();
  return false;
}
</script><% dim rs, sql,rsCate
  '定义Recordset对象,用于保存新闻类别记录集
  Set rs = Server.CreateObject("ADODB.Recordset")
  set rsCate = Server.CreateObject("ADODB.Recordset")
 %>
</head><body bgcolor=#ffffff>
<div align=center><strong><font color="blue" size="3">新 闻 栏 目</font></strong><br><br> 
<%
  '=====显示所有新闻类别供点击,点击不同类别显示该类别的新闻=====
  '按顺序读取所有新闻类别,保存在记录集rsCate中
  sql = "SELECT * FROM Category ORDER BY CateId"
  Set rsCate = conn.Execute(sql)
  '显示所有新闻类别链接
  Do While Not rsCate.EOF
    stitle = rsCate("CateName")
    cid = rsCate("CateId")
    '每个新闻类别标题被定义为一个书签,名为 #a类别编号
%>
    <a href="#a<%=cid%>"><font style='TEXT-DECORATION: none;color:black'><%=stitle%></font></a> |   
<%
    rsCate.MoveNext 
  Loop
%>
<a href='search.asp'><font color=red>新闻查询</font></a>  
 |&nbsp;<a href="index.asp"><font color=red style='TEXT-DECORATION: none'>新闻管理</font></a>   
</div>
<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td width="*" valign="TOP">
<% 
  '将指针移至开始位置,分别显示每个分类中的新闻
  If rsCate.BOF = False Then
    rsCate.MoveFirst
  End If
  '依次显示每个新闻类别中最新的10条新闻
  DO WHILE Not rsCate.EOF
    stitle = rsCate("CateName")
    cid = rsCate("CateId") 
    '变量cnt用来记录
    cnt = 0
    '生成表格
Response.Write "<table width='100%' cellspacing=1 cellpadding=2><tr>" 
'显示新闻类别,并设置书签
Response.Write "<td bgcolor=#ceceff><a name=""a"&cid&"""></a>&nbsp;==&nbsp;"
'显示新闻类别标题
Response.Write stitle + "&nbsp;==</td></tr>"
'生成另一个表格,用于显示新闻标题
Response.Write"<table width='100%' border=0 cellspacing=0 cellpadding=0>"
'按提交时间的降序显示新闻标题
sql = "SELECT * FROM News WHERE CateId=" & cid & " ORDER BY Posttime DESC"
rs.Open sql, conn, 1, 1
DO WHILE Not rs.EOF
  '计数
      cnt = cnt + 1
      '只显示10条新闻
      If cnt < 11 Then
    Dim ndate
    ndate = DateAdd("d",-3,date())
    '显示新闻标题及链接,查看新闻的脚本文件为NewsView.asp
    Response.Write "<tr><td width='50%'><a onClick='return newwin(this.href);' href='NewsView.asp?id=" + cstr(rs("id")) + "'>" + rs("Title") +""
    '如果新闻中有图片,则在标题中显示(附图)
If rs("Attpic") Then  Response.Write "(附图)" End If
Response.Write "</a>"
    '3天内新闻标记new图片
    If datediff("d", rs("Posttime"), ndate+time()) <= 0 Then 
          Response.Write "<img SRC='pic/new.gif' ALT='最新的新闻!' border=0></td>"
        End If 
        '显示新闻提交的时间
Response.Write "<td width='20%'>(" + CStr(rs("Posttime")) + ")</td></tr>"
End If
rs.MoveNext
  Loop
  Response.Write"</table>"
  '设置返回顶部链接,跳转到书签#top
  Response.Write "<p align=right><a href=""#top"">返回顶部</a>&nbsp;&nbsp;&nbsp;"
  '生成“更多新闻”链接,查看指定类别所有新闻的脚本为Category.asp
  Response.Write "<a target='_self' href='Category.asp?flag=" + CStr(cid) + "'>更多新闻...</a></p>"
  Response.Write "</td></tr></table></td></table>"
  rs.Close
  rsCate.MoveNext 
loop
 %>
</td></table><%
  '释放资源
  Set rs = nothing
  Set rsCate = nothing
%>
 <p align=center><a href="javascript:close()">[关闭]</a>
</body>
</html>以上是我编写的代码 使用的数据库是SQL但在运行时出现错误80040e4d错误。请您帮助我解决这个问题
谢谢