D
dapao
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大侠 ,我是新手,刚接触php ,我想用php +ado+assces 数据库 实现代码如下:但是在浏览器中浏览,总是提示 再c:/apache/php/test.mdb下没找到文件。
<?
include('tohtml.inc.php');
// load code common to ADODB
include('adodb.inc.php');
// load code common to ADODB
$db = &ADONewConnection("ado_access");
print "&lt;h1&gt;Connecting $db-&gt;databaseType...&lt;/h1&gt;";
$access = 'test.mdb';
$myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'.'DATA SOURCE='. $access . ';';.'USER ID=;PASSWORD=;';
if (@$db-&gt;PConnect($myDSN, "", "", "")) &#123;
print "ADO version=".$db-&gt;_connectionID-&gt;version."&lt;br&gt;";
$sql = 'select name, group1 from experts';
$rs = $db-&gt;Execute($sql);
rs2html($rs,'border=2 cellpadding=3',array('Customer Name','Customer ID'));
} else
print "ERROR: Access test requires a Access database $access".'&lt;BR&gt;'.$db-&gt;ErrorMsg();
?>
<?
include('tohtml.inc.php');
// load code common to ADODB
include('adodb.inc.php');
// load code common to ADODB
$db = &ADONewConnection("ado_access");
print "&lt;h1&gt;Connecting $db-&gt;databaseType...&lt;/h1&gt;";
$access = 'test.mdb';
$myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'.'DATA SOURCE='. $access . ';';.'USER ID=;PASSWORD=;';
if (@$db-&gt;PConnect($myDSN, "", "", "")) &#123;
print "ADO version=".$db-&gt;_connectionID-&gt;version."&lt;br&gt;";
$sql = 'select name, group1 from experts';
$rs = $db-&gt;Execute($sql);
rs2html($rs,'border=2 cellpadding=3',array('Customer Name','Customer ID'));
} else
print "ERROR: Access test requires a Access database $access".'&lt;BR&gt;'.$db-&gt;ErrorMsg();
?>