Apr 16

PHP 连接 ACESS 不指定

felix021 @ 2008-4-16 18:03 [IT » 网络] 评论(0) , 引用(0) , 阅读(3986) | Via 本站原创 | |
今天才知道PHP支持COM, 真是太恐怖了!

直接看代码吧:
<?PHP
//创建ADO连接
$conn = @new COM("ADODB.Connection") or die ("ADO连接失败!");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("db1.mdb");
$conn->Open($connstr);
//创建记录集查询
$rs = @new COM("ADODB.RecordSet");
$rs->Open("select * from info",$conn,1,3);
?>
<table border=1>
<tr>
  <td>ID</td>
  <td>NAME</td>
  <td>text</td>
</tr>
<?php
while(!$rs->eof){
?>
<tr>
  <td><?php echo $rs->Fields["ID"];?></td>
  <td><?php echo $rs->Fields["NAME"];?></td>
  <td><?php echo $rs->Fields["text"];?></td>
</tr>
<?php
$rs->Movenext();
}
$rs->close();
?>
</table>



欢迎扫码关注:




转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php
Tags: , ,
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   *非必须
网址   电邮   [注册]