PDA

Click to See Complete Forum and Search --> : Setup and deployment


iant1971
Sep 2nd, 2010, 04:35 AM
Hi Guys

i Have built an application with a small SDF database .I am trying to use a setup project to deploy the application i have managed to get the application to install into program files .But when i run i get errors ,But if i run as administrator all works fine . I guess this i due to the database been in the program files . I have tried looking on the Net for a solution but no joy . Sorry if this is a silly question just trying to tech myself VB.net first time i have tried using the setup .Thanks for any assistance

Regards
Ian

Hack
Sep 2nd, 2010, 05:57 AM
Moved To Application Deployment

Nightwalker83
Sep 2nd, 2010, 08:12 PM
Try installing the database to the appdata, local, your program folder (if the folder is not there you'll need to create it).

iant1971
Sep 3rd, 2010, 04:51 AM
Try installing the database to the appdata, local, your program folder (if the folder is not there you'll need to create it).


Thanks Nightwalker83 for the reply . I can see how to write the DB to the User applications data folder (content files from) But how do i get the Application to look there for the DB ? thanks again

Nightwalker83
Sep 3rd, 2010, 05:06 AM
I'm not sure! However, I think Si the geek might have covered it in the Database Development FAQ (http://www.vbforums.com/showthread.php?t=337051).

dilettante
Sep 3rd, 2010, 11:41 AM
CSIDL_LOCAL_APPDATA references a non-roaming per-user directory. Unless you want the application to only work for one user this is the wrong location. Installers can't easily put files there either since they'd need to know which user and then load the user's profile.

The proper location for a database like this would normally be a folder created under CSIDL_COMMON_APPDATA instead. However folders and files created here are assigned "owner" security so that any user aside from the one running your setup will be blocked from writing, deleting, replacing such files. The installer needs to create the subfolder, set the desired security on that folder, then copy the file (database) there.

iant1971
Sep 4th, 2010, 05:03 AM
Hi Guys

Figured it out ,

Dim Cur_Dir As String = CurDir()
Dim DatabasePath As String

DatabasePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
DatabasePath = DatabasePath + "\cal\Cal_DB.sdf"

If System.IO.File.Exists(Cur_Dir & "\Cal_DB.sdf") = True Then
Me.Cal_DB_Table_TableAdapter.Connection.ConnectionString = "Data Source=|DataDirectory|\Cal_DB.sdf"
Else
Me.Cal_DB_Table_TableAdapter.Connection.ConnectionString = "Data Source= " + DatabasePath
End If


this seems to work for me anyway .Thanks for all the help