无法读取数据,求救!

maohongshan 2005-11-15 03:44:13
我正在做一个网站。后台程序已经完成,可在前台程序上出了问题。我不知道如何解决。请各位大侠帮忙!
程序如下:
<%
set rs=server.CreateObject("adodb.recordset")
sql="select top 2 * from news order by id desc"
rs.open sql,conn,1,1
%>
<table width="100%" height="225" border="0">
<%
if rs.eof then
%>
<tr>
<td>暂时没有新闻!
</td>
</tr>
<%else
i=0
do while not rs.eof
%>
<tr>
<td>
<%=cutstr(rs("title"),22)%>
</td>
</tr>
<%rs.movenext
i=i+1
if i=2 then exit do
loop
rs.close
end if
%>
</table>


conn为:
dim conn
dim connstr
dim db
db="DataBase/mydata.mdb" '数据库文件位置
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
数据库路径正确无误
...全文
60 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
maohongshan 2005-11-15
  • 打赏
  • 举报
回复
字段为数字的sql语句怎么调用
maohongshan 2005-11-15
  • 打赏
  • 举报
回复
我的系统是2003
maohongshan 2005-11-15
  • 打赏
  • 举报
回复
数据库中有内容,可就是读不出来,可把我急死了!

28,391

社区成员

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

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