清除访问缓存 [英] Clearing Access Cache

查看:82
本文介绍了清除访问缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Access 中开发一个与 Sql Server 后端通信的系统.我可以连接两个单独的帐户 A 和 B,以便我可以控制权限.特别是我有一个视图,该视图通过传递查询访问,该查询被 A 拒绝但 B 允许.

I am developing a system in Access talking to a Sql Server backend. I can connect with two separate accounts A and B so that I can control permissions. In particular I have a view which is accessed via a pass through query which is denied to A but allowed by B.

通常选择 A 或 B 作为登录名与用户所属的访问安全组有关,但我已将其设置为管理员组中的人员(即我)从内部访问表中读取登录名.我还创建了一个表单(和相关代码),允许管理员更改此值.

Normally selection of A or B as the login is related to which Access Security Group the user belongs in, but I have set it up so that people in the Admins group (ie me) read the login from an internal access table. I have also created a form (and associated code) that allows an Admin to change this value.

这一切都很好,并且完美地完成了它的工作 - 前提是我从头启动 Access.

This all works great and does its job perfectly - provided I start up Access from scratch.

它检测到我是管理员,读取我在内部表中设置的最后一个值,使用正确的登录字符串连接到服务器(我使用这个新的连接字符串循环删除并重新创建所有 tabledef),然后显示我的第一种形式.我导航到运行传递查询的按钮.当我单击该按钮时,它会重新创建传递查询,方法是删除同名查询并使用正确的连接字符串(A 或 B 登录名)重新创建它,然后再运行它以输出结果.如果我是 A,那么它会失败并显示权限错误(我会显示并通知用户),如果我是 B,它会工作并得到结果.

It detects I am admin, reads the last value I set in the internal table, connects to the server with the correct login string (I loop deleting and re-creating all the tabledefs using this new connection string) and then displays my first form. I navigate to a button that runs the pass through query. When I click that button it recreates the pass through query, by deleting one with the same name and recreating it with the correct connection string (A or B login) before then running it to output results. If I am A, then it fails with a permission error (which I display and inform the user about), if I am B it works and I get the results.

为了测试目的,我添加了一个系统来尝试动态更改此设置.更改了管理员应该以谁的身份登录后(通过写入内部表),它会调用启动代码,该代码循环删除和重新创建 tabledef,然后让我回到初始表单.

I have added a system to attempt to change this on the fly for testing purposes. Having changed who Admin should login as (by writing to an internal table), it recalls the startup code, which loops through deleting and re-creating tabledefs and then puts me back at the intial form.

但是 - 如果我现在导航到运行我的权限控制查询的按钮,它仍然会从头开始删除并重新创建查询 def,但是当我运行它时,它似乎在 SQL Server 登录的上下文中运行它在我第一次开始访问时设置,而不是我刚刚重新创建所有内容的新 SQL Server 登录名.所以查询会在不应该运行的时候运行(反之亦然).

HOWEVER - If I now navigate to the button that runs my permission controlled query, it still deletes and re-creates the query def from scratch, but when I run it, it seems to run in the context of the SQL Server Login it set when I first started access, and not the new SQL Server Login I have just re-created everything with. So the query will run when it shouldn't (of visa versa).

如果我退出 Access 并重试 - 它会再次开始正常工作.

If I exit Access and try again - it starts working properly again.

我能从中得出的唯一结论是 Access 内部的某处缓存了 ODBC 连接字符串 - 而不是使用新的而是使用旧的.

The only conclusion I can draw from this is that somewhere inside of Access it is caching the ODBC connection string - and instead of using the new one is using the old.

所以我的问题是 - 我的结论是否正确,如果正确,我该如何告诉 Access 清除其缓存.

So my question is - is my conclusion correct, and if so how can I tell Access to clear its cache.

我正在 Access 2010 中开发 - 用于最终将在 Access 2000 环境中运行的系统 - 因此文件格式是 Access 2000 格式的 .mdb.

I am developing in Access 2010 - for a system that will ultimately be running in an Access 2000 environment - so the file format is an .mdb in the Access 2000 format.

推荐答案

我来到这个话题是因为我有同样的问题:如何清除 Access 2010 中的缓存?"

I came to this topic because I had the same question: "How to clear the cache in Access 2010?"

就我而言,问题在于我的应用程序以某种方式记住"了链接照片的整个路径,即使我只引用了文件名.上面的链接之一引导我在文件 > 当前数据库 > 缓存 Web 服务和 SharePoint 表"下进行搜索.已选中使用与 MS Access 2010 兼容的缓存格式"选项,但我启用了关闭时清除缓存"复选框并关闭了数据库.

In my case, the problem was that my application somehow "remembered" the entire path to my linked photos, even though I referenced only the file name. One of the links above lead me to search under "File > Current Database > Caching Web Service and SharePoint tables." The option to "Use the cache format that is compatible with MS Access 2010" was already checked, but I enabled the check box for "Clear Cache on Close" and closed the database.

瞧!所有以前缓存的值,包括我链接照片的值,都被清除了.此设置似乎不会影响我的 ODBC DNS-less 连接,但我尚未确认这一点.

Voila! All previously cached values, including the values for my linked photos, were cleared out. It doesn't appear that this setting affected my ODBC DNS-less connections, but I haven't confirmed this.

**要清除缓存,请转到文件-->**选项-->当前数据库,然后向下滚动到缓存 Web 服务和 SharePoint 表.****

**TO CLEAR CACHING, go to File-->**OPTIONS-->Current Database, and scroll down to Caching Web Service and SharePoint tables.****

这篇关于清除访问缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆