| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 934 人关注过本帖
标题:[求助]为什么数据库里的内容出不来?
只看楼主 加入收藏
无心
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2005-3-15
收藏
 问题点数:0 回复次数:10 
[求助]为什么数据库里的内容出不来?

<%
dim conn, connstr
on error resume next
connstr="dirver=Microsoft Access Driver (*.mdb);DBQ=" & server.mappath("data/data.mdb")
set conn=Server.CreateObject("ADODB.Connection")
conn.open connstr
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel=stylesheet href="inc/css.css" type="text/css">
<title>无标题文档</title>
</head>

<body>
<center>
<table width="330" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="19" width="330" valign="top" class="a1">公告:
<tr>
<td width="330" height="152" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table-hx">
<tr>
<% call index_diary() %>
</td>
</tr>
</table></td>
</tr>
</table></center>
</body>
</html>


<%
sub index_diary()
set rs=server.createobject("adodb.Recordset")
strSQL="select top 4 content,date from diary order by date DESC"
rs.open strSQL,conn,1,1
do while not rs.eof
response.write "<td width='100%' align='center'>"
response.write "<img src='images/dot.gif' hspace=5 vspace=4>"&rs("content")&"&nbsp;&nbsp;"&rs("date") & vbcrlf
response.write "</td>"
rs.movenext
loop
if rs.bof and rs.eof then
response.write "<td width='100%'>"
response.write "<font color=#666666 >暂无任何公告!</font>"
response.write "</td>"
end if
rs.close
set rs=nothing
end sub
%>

数据库里有两条内容,但为什么调用函数却不能把它输出来呢?是我的函数哪儿写错了吗?
请高手指点下,谢了!

搜索更多相关主题的帖子: 数据库 Microsoft css connstr 
2006-03-28 16:00
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
收藏
得分:0 
<tr>

<% call index_diary() %>

</tr>

2006-03-28 16:12
无心
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2005-3-15
收藏
得分:0 

不行,出不来
等待中...


因为把心给了你,所以我无心.
2006-03-28 16:26
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
收藏
得分:0 
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table-hx">
<% call index_diary() %>
</table>



<%
sub index_diary()
set rs=server.createobject("adodb.Recordset")
strSQL="select top 4 content,date from diary order by date DESC"
rs.open strSQL,conn,1,1
do while not rs.eof
response.write "<tr><td width='100%' align='center'>"
response.write "<img src='images/dot.gif' hspace=5 vspace=4>"&rs("content")&"&nbsp;&nbsp;"&rs("date") & vbcrlf
response.write "</td></tr>"
rs.movenext
loop
if rs.bof and rs.eof then
response.write "<tr><td width='100%'>"
response.write "<font color=#666666 >暂无任何公告!</font>"
response.write "</td></tr>"
end if
rs.close
set rs=nothing
end sub
%>

2006-03-28 16:29
无心
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2005-3-15
收藏
得分:0 

还是不行,出不来.


因为把心给了你,所以我无心.
2006-03-28 16:48
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
收藏
得分:0 
显示什么?是“暂无任何公告!”吗?
还是什么都不显示?

2006-03-28 17:08
无心
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2005-3-15
收藏
得分:0 
什么都显不出来

因为把心给了你,所以我无心.
2006-03-28 18:11
water123456
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:3208
专家分:5
注 册:2006-2-21
收藏
得分:0 
<% call index_diary() %>
这个函数有问题吗?

让我们风风火火的过一生,别平平淡淡过一年。
2006-03-28 18:13
无心
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2005-3-15
收藏
得分:0 
如果有错
错在哪儿呢?

因为把心给了你,所以我无心.
2006-03-28 18:39
无心
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2005-3-15
收藏
得分:0 
等待中.......

因为把心给了你,所以我无心.
2006-03-29 11:51
快速回复:[求助]为什么数据库里的内容出不来?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019717 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved