phpADO组件连接access数据库的例子
时间:2021-07-01 10:21:17
帮助过:27人阅读
/* - * 创建ADO连接
- */
- $conn = new COM("ADODB.Connection") or die ("ADO Connection faild.");
- $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("test.mdb");
- $conn->open($connstr);
- /*
- * 创建记录集
- */
- $rs = new COM("ADODB.RecordSet");
- $rs->open("select * from lhl",$conn,1,3);
- /*
- * 循环读取数据
- */
- while(!$rs->eof){
- echo $rs->fields['G_date']->Value;
- echo "
"; - $rs->movenext(); //将记录集指针下移
- }
- $rs->close();
//ADO组件实例学习 by bbs.it-home.org - ?>
|