为什么读取不了数据库的内容

y928 2001-07-26 11:03:25
源代码如下,却怎么也读取不出数据库的内容,请大家帮忙分析以下,谢谢


<%
dim conn,rs,id

owner=request.querystring("owner")
id=request.querystring("id")

set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("../database/title.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath

set rs=server.createobject("adodb.recordset")

set rs=conn.execute("Select * From bbs Where isbest=1 and owner='" & owner & "' And ID=" & id)
%>

<html>
<head>
<title> 精华版 -> 查看帖子</title>


</head>
<body >
<b class=big>第<%=rs("id")%>帖:<%=left(rs("Topic"),40)%></b>    人气值:<%=rs("click")%>
<hr size="1">
<table width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td>公元:<%=rs("time")%>  这样 <image src=image/face<%=rs("face")%>.gif align=absmiddle> 地说道:</td>
<td align="right"><a href=javascript:history.back()>返 回 >></a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF" align="center" bordercolorlight="#000000">
<tr bgcolor="#000000">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center">
<tr bgcolor="#FFFFFF">
<td>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<p><span class="txt"><br>
<%=changechr(rs("Text"))%></span></p>

</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p align="center"><a href=javascript:history.back()>返 回 精 华 版</a></p>
<div align=center>
<p><font face="Georgia, Times New Roman, Times, serif"><br>
</font>
<p> <%rs.close
set rs=nothing%>
</div>
</body>
</html>
<%
function changechr(str)
changechr=replace(replace(replace(replace(str,"<","<"),">",">"),chr(13),"<br>")," "," ")
changechr=replace(replace(replace(replace(changechr,"[img]","<img src="),"","<b>"),"[red]","<font color=CC0000>"),"[big]","<font size=7>")
changechr=replace(replace(replace(replace(changechr,"[/img]","></img>"),"
","</b>"),"[/red]","</font>"),"[/big]","</font>")
end function
%>
...全文
106 点赞 收藏 12
写回复
12 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
qinli 2001-07-26
装的是IIS还是PWS,有时装不成功会出现这个问题,原来我的机器是98第二版,老是装不上PWS,现在改2000了,装上IIS5.0,ASP是完全支持了。
回复
gooyan 2001-07-26
通过response.write 把sqlstr显示在屏幕上,然后剪贴到query...中,执行一下,看是否可以
回复
fish365 2001-07-26
找不到Page,不一定是都数据库的错!
可能是IIS缓存的缘故,可先把这个文件重命名一下,然后输入url
测试,看看错在那行!!
回复
eastliangliang 2001-07-26
找不到页就看链接,要不就重起,我也碰倒过,莫名其妙,后来又莫名其妙的好了。
回复
sdtashenjie 2001-07-26
Try again:
rs.open "Select * From bbs Where isbest=1 and owner='" & owner & "' And ID='" & id & "'",conn,1,3
回复
chi0591 2001-07-26
错误的提示是什么??
回复
y928 2001-07-26
错误提示也怪,就是找不到该页,
HTTP 500错误,但绝对存在
回复
eastliangliang 2001-07-26
把err.number打出来看看。
回复
y928 2001-07-26
已经改了,还是不行

set rs=conn.execute("Select * From bbs Where isbest=1 and owner='" & owner & "' And ID=" & id)
改为:
rs.open "Select * From bbs Where isbest=1 and owner='" & owner & "' And ID=" & id,conn,1,3
回复
y928 2001-07-26
错误就是读不了数据库的内容
回复
sdtashenjie 2001-07-26
set rs=conn.execute("Select * From bbs Where isbest=1 and owner='" & owner & "' And ID=" & id)
改为:
rs.open "Select * From bbs Where isbest=1 and owner='" & owner & "' And ID=" & id,conn,1,3
回复
eastliangliang 2001-07-26
错误现象是什么啊,有错误提示吗?
看病也需要望闻问切啊。
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2001-07-26 11:03
社区公告
暂无公告