I have a VB6 application that works fine on most Windows 7 machines (even with UAC turned on), but for some of them if the program is not set to ‘Run as administrator’ upon startup it will return the error message ‘No value given for one or more required parameters’ when it tries to query the database.
I know the error message usually means that the table name(s) and/or parameter(s) are spelled incorrectly. But that is not the case here since the same application doing the same proceedures/query calls has no issues on Win XP and some Win 7 machines.
The database is MS Access 2003 format. The database is located in the Program Files directory along with the application exe and dlls.
If this was a consistant error then I could easily debug it and move on, but since all my testing machines do not generate this error, I am at a loss.
Any ideas as to why this occurs and how to fix it?
Thanks,
Chris
Storing database file in Program Files is not a good idea because this location is protected and standard users, and administrators in UAC-enabled system, cannot write to it. You should store the database either in
AppDatain user’s profile orProgramDataif it needs to be shared between all users.Since standard users cannot write to Program Files, Vista/7 have Virtualization mechanism. If a program without write access to Program Files tries to write there, the file system redirects the request to user’s profile. The virtualized Program Files directory is located in
C:\Users\<account>\AppData\Local\VirtualStore. I think you see this error because of virtualization: the database may exist in both locations the real Program Files and the virtualized one, and the files can be different. The virtualized version could not have the required records, that’s why you get the error message.When you start your application as Administrator, Virtualization is disabled and you access the file located in Program Files.
So check if the database file exists in
VirtualStore, and try to find the differences between it and the file stored in Program Files.