include('tohtml.inc.php'); // load code common to ADODB
include('adodb.inc.php'); // load code common to ADODB
$conn = &ADONewConnection('access'); // create a connection
$conn->PConnect('test');// connect to MySQL, agora db
$sql = 'select name, group1 from experts';
$rs = $conn->Execute($sql);
rs2html($rs,'border=2 cellpadding=3',array('Customer Name','Customer ID'));
$rs->Close(); // optional
$conn->Close(); // optional
?>
然后,IE中打入:http://localhost/jhk/dbtest.php
唉!结果出来了。
令人基本满意!!
(5) 接着,我又想:还要设置DSN,烦不烦!绕过DSN应如何解决?因为在asp中,我习惯用conn.open("provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../nydatabase.mdb"))来处理mdb库,那速度快呀!
?……想了又想,看了又看……。
找找找,……,嘿嘿,终于在testdatabases.inc.php 中找到了答案! 我再把刚才的程序改编:
include('tohtml.inc.php'); // load code common to ADODB
include('adodb.inc.php'); // load code common to ADODB