如果是WIN平台,可以用ADO来连,或者是ODBC?

解决方案 »

  1.   

    这个是我写的一个简单的用COM操作ACCESS的例子你看看吧!<?php 
    //create the database connection
    $conn = new COM("ADODB.Connection"); 
    $dsn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("test.mdb"); 
    $conn->Open($dsn); 
    //pull the data through SQL string
    $rs = $conn->Execute("select name,group from experts"); 
    $clients = $rs->Fields(1); 
    //start the multicolumn data output
    $i = 0;
    $columns = 5; 
    while (!$rs->EOF){
    //if $i equals 0, start a row
    if($i == 0){ 
    echo "<tr>"; 
    }
    //then start writing the cells in the row, increase $i by one, and move to the next record
    echo "<td>" . $clients->value . "</td>"; 
    $i++;
    $rs->movenext();
    //once $i increments to equal $columns, end the row, 
    //and start the process over by setting $i to 0 
    if($i == $columns || $rs->EOF) { 
    echo "</tr>";
    $i = 0;

    }
    //end multicolumn data output//close the ADO connections and release resources
    $rs->Close(); 
    $conn->Close();
    $rs = null; 
    $conn = null; ?>
      

  2.   

    php 有个 ado类,专门用ADO来连数据库,包括ACCESS