Home  >  Article  >  Backend Development  >  php + access + ADODB.Connection 数据更新失败

php + access + ADODB.Connection 数据更新失败

WBOY
WBOYOriginal
2016-06-23 13:57:541201browse

$conn = new COM("ADODB.Connection", NULL, 65001) or die ("ADO连接失败!");		$connstr = 'DRIVER={Microsoft Access Driver (*.mdb)};pwd=luchg;DBQ=' . realpath($config['database']['path']);		$conn->Open($connstr);$rs = $db->execute($sql) or die($db->ErrorMsg());


查询没问题,但是修改删除添加不行,也没有错误,而且更新后 access 处于 锁定状态,就是有个有个同名的ldb文件
环境 iis + php4
在apache + php5 下没问题,求大神指教

(PS : 必须使用 php + access,因为用到 json 所以必须使用 utf8 编码,所以只能使用 这种连接方式才能设置为utf8 编码)


回复讨论(解决方案)

1、Access 支持 utf-8 编码吗?
2、你的 open 方法没有给访问权限,默认是只读的

1、Access 支持 utf-8 编码吗?
2、你的 open 方法没有给访问权限,默认是只读的


用 new COM("ADODB.Connection", NULL, 65001) utf8 是没有问题的

2、你的 open 方法没有给访问权限,默认是只读的 什么意思?怎么给权限?已经给mdb文件读写权限了,程序还需要配置吗?

建议你用ADODB类来操作

var conn = new COM("ADODB.Connection", NULL, 65001);
conn->Open($connstr);
var rs = new COM("ADODB.RecordSet", NULL, 65001);
rs->Open($sql, $conn, $o, $l);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn