visual studio 2010 - Building my project sets the database to read only? -


i have developed program in visual studio using vb connects .db database. when debug it, works fine database on computer not set read (i checked right clicking file , going properties).

i use standard visual studio set project build , read property of database in set project set false. when build project , install on machine, database somehow gets set read , error "attempt write read-only database"

does know how go solving this? thanks

edit: hmm have checked , folder database , other program files gets added marked "read (only applies files in folder)". whilst database not marked read only, folder is. perhaps because in program files folder?

the folders c:\program files or c:\program files (x86) protected operating system (vista , after) write operation security reasons. approved folder writing application wide data (settings or database file defined querying environment.specialfolder enum , retrieving value of commonapplicationdata

the standard setup tool used in visual studio 2010 has no predefined folder points commonapplicationdata directly, use workaround:

  • right click on file system, select add special folder , custom folder
  • give name new folder in file system tree
  • set property defaultlocation [commonappdatafolder]
  • create subfolder application right click on new added folder custom folder
  • use folder add database file.

of course application should change connectionstring refer new location of file. in c# write this

string commondata = environment.getfolderpath(environment.specialfolder.commonapplicationdata); string pathtodbfile = path.combine(commondata, "myappdir", "mydb.sqlite"); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -