代码如下
<?php
echo 'hello1';
$conn = @new COM("ADODB.Connection") or die ("ADO Connection faild.");
echo 'hello2';
$connstr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=".realpath("db.mdb");
//$connstr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=".Server.MapPath("db.mdb");
echo 'hello3';
$conn->Open($connstr);
echo 'hello4';
$rs = @new COM("ADODB.RecordSet");
echo 'hello5';
$rs->Open("select * from users",$conn);
echo 'hello6';
while(!$rs->eof){
echo $rs->Fields["name"]->Value;
echo "<br/>";
$rs->Movenext(); //将记录集指针下移
}
$rs->close();
?>
发现只输出 hello1而不输出hello2,
说明
$conn = @new COM("ADODB.Connection") or die ("ADO Connection faild.");
并没有执行成功。
弄了很长时间不知道是什么问题,大家看看?