[英]Why can't I retrieve data from an mdb file in Windows 7 64-bit?
I recently bought a software that uses an mdb file for data storage. 我最近购买了一个使用mdb文件进行数据存储的软件。 I don't like the software's reporting and statement generation that much so I decided to write my own reporting program using VS 2008's C#.
我不太喜欢该软件的报告和报表生成功能,因此我决定使用VS 2008的C#编写自己的报告程序。
So my program accesses the mdb file that comes with the software I just bought. 因此,我的程序访问了我刚购买的软件随附的mdb文件。 My dev environment is Windows XP.
我的开发环境是Windows XP。 My deployment environment is Windows 7 64-bit.
我的部署环境是Windows 7 64位。 In my dev machine, I can retrieve records from the mdb file just fine but when I deploy the program to a Windows 7 64-bit machine, it cannot read the records from the mdb file.
在我的开发机中,可以很好地从mdb文件中检索记录,但是当我将该程序部署到Windows 7 64位计算机上时,它无法从mdb文件中读取记录。 No errors are thrown, it just can't get that data.
没有抛出任何错误,只是无法获取该数据。
I also tried installing VS 2012 on the deployment machine (Win 7 64-bit) and imported my VS2008 project there. 我还尝试在部署机器(Win 7 64位)上安装VS 2012,并将我的VS2008项目导入那里。 Same issues, can't get records from that mdb file (again, no errors are thrown).
同样的问题,无法从该mdb文件获取记录(再次,不会引发任何错误)。
Please help? 请帮忙?
edit 1: I just tried backing up the mdb using the purchased software backup utility. 编辑1:我只是尝试使用购买的软件备份实用程序备份mdb。 I can retrieve records from that backed up mdb.
我可以从备份的mdb中检索记录。 I wonder if the software is trying to modify my access to the mdb file.
我想知道软件是否正在尝试修改对mdb文件的访问。
edit 2: I don't think the software is trying to modify my access to the mdb file because when deployed to my xp machine, I can access the mdb file just fine. 编辑2:我不认为该软件试图修改对mdb文件的访问权限,因为当部署到我的xp机器上时,我可以很好地访问mdb文件。
edit 3: I'm beginning to suspect this is a file security feature within Windows 7. 编辑3:我开始怀疑这是Windows 7中的文件安全功能。
edit 4: If I copy the mdb file and access that copied mdb file, it returns 0 rows. 编辑4:如果我复制mdb文件并访问该复制的mdb文件,它将返回0行。 If I back it up using the software's backup utility, it returns the exact rows I expect.
如果我使用该软件的备份实用程序进行备份,它将返回我期望的确切行。
The problem is that you're running up against security features of Windows. 问题是您正在运行Windows的安全功能。
Programs are no longer allowed to change files under the program files directories, unless they run with elevated access. 除非程序以提升的访问权限运行,否则不再允许程序更改程序文件目录下的文件。
What happens is that a feature called Virtual Store kicks in and creates private (for your user) copies of the file somewhere else, under your user profile. 发生的事情是启动了一个名为“ 虚拟存储”的功能,并在用户配置文件下的其他位置创建了文件的私有副本(为您的用户)。
Most likely the software has created an empty database file under the user profile, and is accessing that instead. 该软件很可能在用户配置文件下创建了一个空的数据库文件,并且正在访问该文件。
You can not place writable files in the program files any more, the program needs to be either redesigned or installed somewhere else, like under the user profile where it would have write access. 您不能再将可写文件放在程序文件中,需要重新设计该程序或将其安装在其他位置,例如在具有写访问权的用户配置文件下。
将目标平台设置为“ x86”,而不是“ Any cpu”,以确保您运行的是32位。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.