|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
[asp]数据读取不出来?
[code]
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<%if request.cookies("adminok")="" then
response.redirect "login.html"
end if%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>分类管理</title>
</head>
<body>
<table width="100%" border="0">
<tr align="center">
<td width="70%">分类名称</td>
<td width="30%">操作</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from catalog"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write("暂时没有分类")
else
do while not rs.eof
%>
<tr align="center">
<td><%=rs("cname")%></td>
<td><a href="fl_del.asp?id=<%=rs("id")%>">删除</a>,<a href="fl_edit.asp?id=<%=rs("id")%>">修改</a></td>
</tr>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</table>
<form name="form1" method="post" action="fl_add.asp">
<input type="text" name="cname">
<input type="submit" name="Submit" value="增加分类">
</form>
<p> </p>
</body>
</html>
[/code]
上面的代码运行之后,一直显示暂时没有分类。可我的数据库里已经有2条记录了。
|
if rs.eof and rs.bof then
改成
if rs.eof or rs.bof then |
实在是郁闷啊!
检查了多次表,看看字段有没有填错,没有发现有填错啊。连接数据库文件,之前一直都正常,都能显示文章的。
怎么到了做个分类,却显示不出来。
高手都到哪里去了,快快出来帮忙看看啊。
|
if rs.eof and rs.bof then
response.write("暂时没有分类")
else
........
end if
改成
if rs.eof then
response.write("暂时没有分类")
else
........
end if
试试 |
senfe兄弟,还是老样子啊。 |
郁闷~~论坛消息PM数据库过来~~我写代码比较粗心,测试着来要好些~~ |
妈的,自己检查出来了。改下表名catalog为fl。
搞不懂为什么会这样。 |
谢senfe兄弟了,已经解决了,可不知道表名catalog为什么不行。 |
在表名上面加[]
sql="select * from [catalog]" |
senfe兄弟,按你说的加上[]也行。可不知道为什么?难道是保留字吗?
妈的,浪费了我一天的时间啊,我哭啊/ |
|