我是连接ACCESS的,如何分离 记录集的读取和 数据库连接呢?
我想把数据集的数据读取查询,但不想老读取1次就得 连接1次数据库。 求教如何使用函数<?php/* 
创建ADO连接 
*/ 
$conn = @new COM("ADODB.Connection") or die ("ADO Connection faild."); 
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("../data/sendland.mdb"); 
$conn->Open($connstr); function select_send(){
/* 
创建记录集查询 
*/ 
$rs = @new COM("ADODB.RecordSet"); 
$rs->Open("select a.name,a.post,a.tel,a.ext,a.computer_IP,a.computer_name,a.computer_oa from staff as a,Department as b where a.Department_id=b.id",$conn,1,3);/* 
循环读取数据 
*/ 
while(!$rs->eof){
echo "<tr><Td></Td><td>";
echo $rs->Fields["name"]->Value;
echo "</td><td>";
echo $rs->Fields["post"]->Value;
echo "</td><td>";
echo $rs->Fields["tel"]->Value;
echo "</td><td>";
echo $rs->Fields["ext"]->Value;
echo "</td><Td>";
echo $rs->Fields["computer_IP"]->Value;
echo "</Td><Td>";
echo $rs->Fields["computer_name"]->Value;
echo "</Td><Td>";
echo $rs->Fields["computer_oa"]->Value;
echo "</Td><Td></Td></tr>";
$rs->Movenext(); //将记录集指针下移 

$rs->close(); 
}
select_send();
?>