我正在使用一个访问 MS-Access DB 的程序。问题是,如果我使用 Access 打开 db 文件,我看到的值不是我使用该程序时看到的值。例如,有一个表 PARAMS ,其中包含各种程序变量,其中之一是我上次加载某个文件的日期。在 Access 中,它显示的是 2010 年 4 月 12 日,而在程序中,它显示的是 2010 年 5 月 7 日(这是正确的)。
4 月 12 日是我将计算机升级到 Windows 7 的时间。此外,mdb 文件位于 C:\Program Files (x86) 中的程序可执行文件旁边;我知道Win7不允许程序写入程序文件目录。那么更改保存在哪里呢?
我尝试过的:
我尝试在另一台计算机上打开 mdb 文件 - 仍然读取错误的(旧)值
我尝试将整个程序目录复制到另一个文件夹 - 现在程序和 ms-access 都读取了错误的值。
有人可以告诉我如何获取包含与程序最新的所有值的数据库版本吗?
谢谢。
I'm working with a program that accesses an MS-Access DB. The problem is that if I open the db file with Access, the values I see aren't the values I see when I'm using the program. For example, There is a table PARAMS with various program variables, one of them is the date I last loaded a certain file. In access it reads April 12th 2010, while in the program it reads May 7th 2010 (this is correct).
April 12th is about the time I upgraded the computer to Windows 7. Also, the mdb file sits next to the program executable in C:\Program Files (x86); and I know that Win7 doesn't allow programs to write to the program files dir. So where are the changes saved?
What I've tried:
I've tried opening the mdb file on another computer - still reads the wrong (old) values
I've tried copying the entire program dir to a different folder - now both the program and ms-access read the wrong values.
Can someone tell me how to get a version of the DB with all the values up to date with the program?
Thanks.
发布评论
评论(2)
您是否将数据库放在应用程序文件夹中?如果是这样,您可能正在经历 UAC 虚拟化(又名数据重定向)。
例如,如果应用程序尝试写入 C:\Program Files\Contoso\Settings.ini,并且用户没有写入该目录(Program Files)的权限,则写入操作将被重定向到 C: \Users\Username\AppData\Local\VirtualStore\Program Files\Contoso\settings.ini”
数据库应存储在 %APPDATA% 文件夹中。
http://windowsteamblog。 com/blogs/developers/archive/2009/08/04/user-account-control-data-redirection.aspx
http://support.microsoft.com/kb/927387
Are you putting the database in the application folder? If so, you are probably experiencing UAC Virtualization (AKA Data Redirection).
"For example, if an application attempts to write to C:\Program Files\Contoso\Settings.ini, and the user does not have permissions to write to that directory (the Program Files), the write operation will be redirected to C:\Users\Username\AppData\Local\VirtualStore\Program Files\Contoso\settings.ini"
The database should be stored in the %APPDATA% folder instead.
http://windowsteamblog.com/blogs/developers/archive/2009/08/04/user-account-control-data-redirection.aspx
http://support.microsoft.com/kb/927387
当您在 Windows 资源管理器中查看程序文件时,请查找带有“组织”、“打开”、“打印”、“刻录”等内容的按钮,上面写着“兼容性文件”。通常,这会将您带到文件夹的虚拟化位置。
另外,如果您愿意忍受 UAC 提示,如果您以管理员身份运行该应用程序,它将写入程序文件下的位置。或者,如果您将安装移动到程序文件以外的其他位置,尽管这会导致您失去防止有人更改 exe 的保护,但它也会写入应用程序目录。
When you are looking at Program Files in a Windows Explorer, look for a button along with Organize, Open, Print, Burn etc that says
Compatibility Files
. That in general will take you to the virtualization location for a folder.Also, if you are willing to put up with the UAC prompt, if you run the application as an administrator it will write to the location under program files. Or if you move your installation to somewhere other than program files, though this would cause you to lose protection against someone changing the exe, it will write to the application directory also.