代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Php论坛</title>
<link href="Style/Style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="700" align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#996633">
<tr>
<td align="center" height="20"><font color="#FFFFFF"><b>帖子列表</b></font></td>
</tr>
<?php
$Conn=new com("adodb.connection");
$Db=realpath("Database/bbs.mdb");
$Conn->open("driver=microsoft access driver (*.mdb);dbq=".$Db);
$Rs=$Conn->execute("Select * From Bbs Order By BbsId Desc");
if($Rs->eof && $Rs->bof)
{
?>
<tr><td height="100" align="center" bgcolor="#ffffff">无记录</td></tr>
<?php
}
else
{
while(!$Rs->eof)
{
?>
<tr>
<td align="center" valign="top" bgcolor="#ffffff">
<table width="700" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" width="50" height="20" bgcolor="#ffffff"><? echo($Rs->fields["BbsId"]); ?></td>
<td align="left" width="400" height="20" bgcolor="#ffffff"><? echo($Rs->fields["BbsTitle"]); ?></td>
<td align="center" width="100" height="20" bgcolor="#ffffff"><? echo($Rs->fields["BbsAuthor"]); ?></td>
<td align="center" width="150" height="20" bgcolor="#ffffff"><? echo($Rs->fields["BbsTime"]); ?></td>
</tr>
</table>
</td>
</tr>
<?php
$Rs->movenext;
}
}
$Rs->close();
$Conn->close();
?>
</table>
</body>
</html>
运行第一次时,没有错误.当再次刷新时,说对象关闭,不允许操作.谁知道是为什么?而且还抛出异常