什么时候调用DBEngine.Idle dbRefreshCache合适?
在 VB6 中使用 DAO,这两个示例中哪一个是 DBEngine.Idle dbRefreshCache
最合理的使用?
示例 1:
customers.Index = "primarykey"
customers.Seek "=", this_date, supplier
DBEngine.Idle dbRefreshCache
示例 2:
DBEngine.Idle dbRefreshCache
customers.Index = "primarykey"
customers.Seek "=", this_date, supplier
Using DAO in VB6, which of the two examples is the most sensible use of DBEngine.Idle dbRefreshCache
?
Example 1:
customers.Index = "primarykey"
customers.Seek "=", this_date, supplier
DBEngine.Idle dbRefreshCache
Example 2:
DBEngine.Idle dbRefreshCache
customers.Index = "primarykey"
customers.Seek "=", this_date, supplier
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来
customers
是一个 ADO 记录集?因此示例 2(首先刷新缓存)会更有意义。DBEngine.Idle dbRefreshCache
用于两个进程之间同步读写。 ADO 记录集查找
如果您在操作搜索之前发出DBEngine.Idle dbRefreshCache
,则操作搜索更有可能显示另一个进程所做的更改。寻找
。我想一个问题是是否真的有另一个进程正在更改数据?或者(可能)来自同一程序的另一个数据库连接?如果没有,则根本不需要刷新缓存。
Looks like
customers
is an ADO recordset? So example 2 (refresh cache first) would make more sense.DBEngine.Idle dbRefreshCache
is used to synchronize reading and writing between two processes. The ADO RecordsetSeek
operation search is more likely to show up changes made by another process if you issueDBEngine.Idle dbRefreshCache
before theSeek
.I guess one question is whether there really is another process changing the data? Or (possibly) another database connection from the same program? If not, there's no need to refresh the cache at all.