Search code examples
databasevb.netlocal-database

Where is the right place for the database of a program on Windows 7?


I wrote a programm(VB.NET 2010) with an local database(.SDF). Now im going to add a Setup. Where should I place the database? Where is the usually place, for database? OS = Windows 7

C:\ProgramData (COMMONAPPDATAFOLDER) or C:\Program Files(x86) aren't good ideas, because the normal local client has there only read and execute permission. The normal client should be able to modify the database.

I hope you can help me. Thank you! BK_


Solution

  • C:\ProgramData should be written by any user on the computer.

    If you want a per-user database, put it under Environment.SpecialFolder.LocalApplicationData, if you want a per-computer, put under Environment.SpecialFolder.CommonApplicationData.

    See well know location here: Environment.SpecialFolder Enumeration