使用php的odbc函数,不创建数据源。
$connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ=".realpath("test.mdb") ;
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC );
亲试代码,可用哦。
Php + Access sample code.
<?php /*** This file is just for an example of Php+Access. You can find these functions from http://www.php100.com/cover/php/1681.html */ /* ODBC string */ $odbc = "Driver={Microsoft Access Driver (*.mdb)};Dbq=".realpath("our.mdb"); $conn = odbc_connect($odbc, '', '', SQL_CUR_USE_ODBC); $sql ="select * from test"; $query = odbc_exec($conn, $sql); print $query."</br>"; $num = odbc_num_fields($query); if ($num != 0) for($i=1; $i<$num; $i++) { $row = odbc_fetch_row($query); echo "->".odbc_result($query,"Addr")."</br>"; //echo "->".odbc_result($query,3)."</br>"; /* the same as Line 24*/ } else print "No data"; ?>