为什么 更新 access 数据库时 要等 2-3 秒 才能看到更新的数据??????例如:
有一个叫 table1 的表 ,有一个长整型的 maxid 字段 :maxid
1
--------------------------------使用下面的代码进行更新:adocommand1.CommandText:='update table1 set maxid=2 ';
adocommand1.Execute;
然后马上使用下面代码查看maxid:adodataset1.Active :=false;
adodataset1.CommandText:='select * from table1';
adodataset1.Active :=true;
但数据maxid还是 1 要等 2-3 秒后 ,执行 下面代码:
adodataset1.Active :=false;
adodataset1.CommandText:='select * from table1 ';
adodataset1.Active :=true;
这时 maxid 值才是 2
---------------------------------
为什么要等 2-3 秒后 ,才看 到 更新的 数据 ???? 这是 access 本身的问题吗?? sql server 也有这样的问题吗?????
有一个叫 table1 的表 ,有一个长整型的 maxid 字段 :maxid
1
--------------------------------使用下面的代码进行更新:adocommand1.CommandText:='update table1 set maxid=2 ';
adocommand1.Execute;
然后马上使用下面代码查看maxid:adodataset1.Active :=false;
adodataset1.CommandText:='select * from table1';
adodataset1.Active :=true;
但数据maxid还是 1 要等 2-3 秒后 ,执行 下面代码:
adodataset1.Active :=false;
adodataset1.CommandText:='select * from table1 ';
adodataset1.Active :=true;
这时 maxid 值才是 2
---------------------------------
为什么要等 2-3 秒后 ,才看 到 更新的 数据 ???? 这是 access 本身的问题吗?? sql server 也有这样的问题吗?????
设置了之后可能会解决你的问题……
不过设置成服务器连接后,其他使用时可能产生部分问题……
用adodataset.close,然后再open
在一开始就设置为使用SERVER模式,再写入看看
注意,ADO连接器和ADO表、ADO查询都有这个属性项目,注意将其设为一致……