1. 在控制面板中打开管理工具
2. 双击其中的数据源 (ODBC) 图标
3. 选择系统 DSN 选项卡
4. 点击系统 DSN 选项卡中的“添加”按钮
5. 选择 Microsoft Access Driver。点击完成。
6. 在下一个界面,点击“选择”来定位数据库。
7. 为这个数据库取一个数据源名 (DSN)。
8. 点击确定。
在php中连接数据源:
$conn = odbc_connect("phpaccess","","");//连接数据源
$result = "select * from person";
$rs = odbc_exec($conn,$result);
if(!$rs){
echo "Could not insert";
}
echo "<table><tr>";
echo "<th>FirstName</th>";
echo "<th>LastName</th></tr>";
while($row=odbc_fetch_array($rs)){
//$firstname = odbc_result($rs,"first_name");
//$lastname = odbc_result($rs,"last_name");
echo "<tr><th>".$row['first_name']."</th>";
echo "<th>".$row['last_name']."</th></tr>";
}
echo "</table>";
odbc_close($conn);//关门odbc连接