Open("">
时间:2021-07-01 10:21:17 帮助过:3人阅读
$connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
$issuetime=date("Y-m-d H:i:s");
$sql="insert into test values("","",...)";
$result=odbc_exec($connid,$sql);
if($result) echo "successful";
else echo "failed";
?>
之二:
代码如下:输出log_Title字段
//创建ADO连接
$conn = @new COM("ADODB.Connection") or die ("ADO连接失败!");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("temp/TempData.mdb");
$conn->Open($connstr);
//创建记录集查询
$rs = @new COM("ADODB.RecordSet");
$rs->Open("select * from blog_Content",$conn,1,3);
echo $rs->Fields["log_Title"]->Value; //
echo "
";
$rs->Movenext(); //将记录集指针下移
echo $rs->Fields["log_Title"]->Value;
$rs->close();
?>
方法三:用ODBC,在ODBC治理器中为db1.mdb建一处系统数据源(一般需要服务器权限,不建议使用)
名称:dbdsn (可以自己定)
驱动程序:Microsoft Access Driver (*.MDB)
代码:
代码如下:
$Conn = odbc_connect("dbdsn","admin","123"); //连接数据源
$Doquery=odbc_exec($Conn,"select * from 表名 where 条件");//执行查询
http://www.bkjia.com/PHPjc/327737.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327737.htmlTechArticlePHP代码: 需要注意php获取路径用的是realpath 代码如下:
?php $connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.mdb"); $connid=odb...