欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

PHP中通过ADODB库实现调用Access数据库之修正版本 原创

程序员文章站 2022-05-23 09:26:00
最主要的下载地址了,请先看上一篇文章。本地下载 此文件解压后放到adodb目录里,最好是全部啊,不是只有ohtml.inc.php和adodb.inc.php引用的确实只要...
最主要的下载地址了,请先看上一篇文章。


本地下载PHP中通过ADODB库实现调用Access数据库之修正版本 原创
此文件解压后放到adodb目录里,最好是全部啊,不是只有ohtml.inc.php和adodb.inc.php
引用的确实只要这两个就可以了

复制代码 代码如下:

<?php
include('adodb/tohtml.inc.php'); // load code common to adodb
include('adodb/adodb.inc.php'); // load code common to adodb
$db = &adonewconnection("ado_access");
print "<h1>connecting $db->databasetype...</h1>";
$access = 'e:\php\phpaccess\test.mdb';
$mydsn = 'provider=microsoft.jet.oledb.4.0;'.'data source='. $access.';user id=;password=;';
//注意了,mdb地址是物理地址啊
if (@$db->pconnect($mydsn, "", "", "")) {
print "ado version=".$db->_connectionid->version.";
";
$sql = 'select thename from news';
$rs = $db->execute($sql);
rs2html($rs,'border=2 cellpadding=3',array('customer name','customer id'));
} else print "error: access test requires a access database $access".';
'.$db->errormsg();
?>

数据库呢,普通的access数据库,和正常的一样,不需注意什么
测试通过。如果有更好的建议请,请在评论里指出