|
-
Jul 15th, 2011, 09:52 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Access database in VB.Net setup that is writeable in Windows 7
I have a VB.Net program which reads and writes to an Access database. I am trying to deploy the program using a setup (created with INNO Setup). Upon installation on a Windows 7 computer, Windows 7 is preventing it from writing data without changing the permission settings. It reads data but it doesn't write data. This problem doesn't happen in Windows XP. My question is: is there any way to make the Visual Basic .Net program write data to an Access database on Windows 7 from the setup without the user having to change permission settings?
-
Jul 15th, 2011, 10:14 AM
#2
Re: Access database in VB.Net setup that is writeable in Windows 7
Put the access database into the user data folder... I'm guessing you deployed the file to the same folder as where the app is installed (like Program Files) ... right? Starting with Win7, things are locked down in the Program Files folder... it's no longer a reliable place to be writting data... try searching the forums for "|Data|" ... include the pipe symbol... it should turn up a lot of examples on how to use it.
In short, the path to the database file should be "Database=|Data|\myaccessfile.msdb" or something along those lines. When you deploy it (and I don't know how to do this in INNO) it needs to be moved to the user's app data folder.
-tg
-
Jul 15th, 2011, 10:38 AM
#3
Thread Starter
Fanatic Member
Re: Access database in VB.Net setup that is writeable in Windows 7
Thanks for responding.
I don't understand. Shouldn't that be "Database=|Data|\App_data\myaccessfile.msdb" ?
This is what I'm using
Code:
Public connSTR As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;User ID=;Password=;Data Source=|DataDirectory|\TransActionsDB.mdb"
and the database is placed in the application's root folder in Program Files when it gets to Win 7. INNO setup can put it wherever, I think. Is |Data| the same as |DataDirectory| ?
Last edited by projecttoday; Jul 15th, 2011 at 10:50 AM.
-
Jul 15th, 2011, 10:50 AM
#4
Re: Access database in VB.Net setup that is writeable in Windows 7
yes... DataDirectory is right... but... that's still not the same as the app's root folder, which is where you are installing it. What you could do is check to see if the file exists in the data directory first, if it doesn't exist, COPY it from the app folder to the Data Directory, then you should be able to connect to it from there. That way, also you don't need to make changes to the install, and if the database gets deleted for what ever reason, the app can copy a new one and won't crash.
-tg
-
Jul 15th, 2011, 11:17 AM
#5
Thread Starter
Fanatic Member
Re: Access database in VB.Net setup that is writeable in Windows 7
I'm looking through some of the posts here on |DataDirectory|
DataDirectory is right... but... that's still not the same as the app's root folder
Can you explain?
Can I just add a subfolder and put the database there? If this subfolder resides in the Program Files application main folder, wouldn't it be subject to the same permission restrictions (on Windows 7)? I know I said INNO setup will copy the database anywhere but I'm not sure if it will create a new folder.
-
Jul 15th, 2011, 12:03 PM
#6
Re: Access database in VB.Net setup that is writeable in Windows 7
"If this subfolder resides in the Program Files application main folder, wouldn't it be subject to the same permission restrictions (on Windows 7)?" -- no because it doesn't exist in the Programs Folder... it resides in
C:\users\yourusername\apps\data\another folder\somewhere around here....
if it's installed for everyone, then instead of being in yourusername, it'll go into the "all users" one.
-tg
-
Jul 15th, 2011, 12:32 PM
#7
Thread Starter
Fanatic Member
Re: Access database in VB.Net setup that is writeable in Windows 7
I think in VB.Net it does go in the same folder.
-
Jul 15th, 2011, 02:01 PM
#8
Re: Access database in VB.Net setup that is writeable in Windows 7
If the user has MS-Access 2007+ installed then more one consideration is MS-Access Trust Center which will not throw an exception/error when you attempt to do a update or insert query against a ms-access database via your code in .net.
http://office.microsoft.com/en-us/wo...010031999.aspx
-
Jul 15th, 2011, 02:07 PM
#9
Thread Starter
Fanatic Member
Re: Access database in VB.Net setup that is writeable in Windows 7
Have you worked with Access 2007 databases and setup? I have Access 2007 on my computer but I saved it as Access 2003 for this project. (Why tempt fate?)
-
Jul 15th, 2011, 03:16 PM
#10
Re: Access database in VB.Net setup that is writeable in Windows 7
 Originally Posted by projecttoday
Have you worked with Access 2007 databases and setup? I have Access 2007 on my computer but I saved it as Access 2003 for this project. (Why tempt fate?)
Yes but my company/agency uses MSI pushes and set polices via active directory.
You might like to look that the following
http://www.access-programmers.co.uk/...d.php?t=136411
http://bytes.com/topic/access/answer...ue#post2752405
I do not believe it matters what version you saved it as but instead what version of MS-Access the client has installed.
-
Jul 15th, 2011, 03:23 PM
#11
Thread Starter
Fanatic Member
Re: Access database in VB.Net setup that is writeable in Windows 7
This is for an Access deployment. For a Visual Basic program the target computer does not have to have any version of Access installed.
-
Jul 15th, 2011, 09:02 PM
#12
Re: Access database in VB.Net setup that is writeable in Windows 7
 Originally Posted by projecttoday
This is for an Access deployment. For a Visual Basic program the target computer does not have to have any version of Access installed.
You should look at the link below which includes links for deployment options
http://technet.microsoft.com/en-us/l...ffice.12).aspx
-
Jul 15th, 2011, 10:12 PM
#13
Addicted Member
Re: Access database in VB.Net setup that is writeable in Windows 7
this seems like the UAC doing its magic in vista/7
you need to set this in the app.manifest file
HTML Code:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|