你好 旧时光天狼视频:简单asp出错了!

来源:百度文库 编辑:高校问答 时间:2024/05/04 14:53:28
<!--#include file="dbconn.asp" -->
<%
dim username
username=request.cookies("username")
%>
<body>
<%
exec="Select * From shoucang where read=0 and username="&username&""
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%do while not rs.eof%><tr>
<td><%=rs("name")%></td>
<td><%=rs("url")%></td>
<td></td>
<td></td>
</tr><%
rs.movenext
Loop
%>
</table>

运行时提示:

错误 '80004005'
/shoucang.asp,行 17
上面的源文件就是:shoucang.asp

提示17行出错,也就是说 rs.open exec,conn,1,1 这段代码错了

exec=\"Select * From shoucang where read=0 and username=\"&username&\"\"
改成:
exec=\"Select * From shoucang where read=0 and username=\'\"&username&\"\'\"

username是字符串

="&username&"" 改成='"&username&"'" 试试.

shoucang.asp在哪里?