How to copy access Database file, mdb from program files to Isolated Storage in c#
Asked Answered
C

1

7

I am building an IE Addon or Extension using C#. I have created an Access Database MDB file which will be in the Program files. Now at runtime I need to copy this MDB file to Isolated Storage so that I can use it further. As I can't access AppData if Protected Mode is ON in IE. I have seen few code samples which enables me to write files in Isolated Storage, but here I need to copy my database file MDB in Isolated Storage. Please come up with some code. Awaiting your response.

Thanks

Claret answered 6/1, 2011 at 7:56 Comment(5)
" Please come up with some code. Awaiting your response" - ...and how did this question get 7 upvotes?Il
Even if you can copy the MDB file into isolated storage, I'm not aware of any way to get the Jet engine to read it from there - you generally have to pass an actual path to Jet to get it to open MDB filesDesuetude
A Jet/ACE data file needs to be read/write, so Programs is never going to be the right place to put it (it would only work when you process was running with an admin security token, or if you've set special permissions on the folder where the database is stored). The correct place for storing any Jet/ACE database is in AppData, but there are differences between Vista/Win7 and previous versions of Windows in what the API call to find the location of AppData returns. The user's profile has a number of places where it should work, but I don't know how that interacts with IE's protected mode.Uncommunicative
@ David-W-Fenton: You are right. But I am not interacting with DB in Program Files, usually I would copy it to Appdata on installataion as I send the MDB file with Setup. So, after being copied to Appdata the program doesn't interact with DB in Program Files. The problemhere is with IE Protected Mode in Vista or XP, my Addon isn't able to access any of these folders. So I was thinking of Isolated Storage, but it doesn't seem to work out.Claret
My point is that you can't ever put an MDB in the program files folder unless the process that you use to open it is running with an administrative security token, or one for a user that is a member of a security group that has read/write permission on the folder in the program files folder. In other words, you can only do it if you have a non-standard setup that's been altered by an administrator. It's simply the wrong place to ever put any MDB files, period. The only case where it would work is if you're using the MDB in program files as a template that you copy elsewhere.Uncommunicative
G
1

Why not look at an alternative to doing this in access. There are reasons why certain things cannot be accessed in "protected mode".

Grau answered 6/1, 2011 at 13:39 Comment(3)
Yes, definitely I can go for an alternate, but what that could be?? I need a DB file somewhere on his local system to keep the records, is there another location which can be accessed by Extensions when IE is in Protected Mode??Claret
What data are you storing? Having a quick look around on the stack i found this - have to say I have never had to solution your issue, however this may help you #1993265Grau
Thanks for the link, but I have already been through that link, but it doesn't solve the problem. Actually it's an Access Database which contains 2 tables, 1st contains Username, UserID and the 2nd contains the same fields and serves different purpose.Claret

© 2022 - 2024 — McMap. All rights reserved.