Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Do I need to store my database in Application Data folder instead of Application.StartUp folder

Do I need to store my database in Application Data folder instead of Application.StartUp folder

Scheduled Pinned Locked Moved C#
databasequestionhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nadia Monalisa
    wrote on last edited by
    #1

    Hi, I developed a desktop application using SQL Compact, used Entity Framework. Now I see, Entity Framework's connection string is not that simple, it stored many information in the connection string in app.config file. So, I do not touch that file. But what I see, the database folder is user |DataDirectory| which is actually Application.StartUpPath. When I distribute my program to end users, will they be able to run my application where the database is in the program files folder ? I know it was not a problem for XP. But when Vista came, the 'User Account Control' feature prevented accessing any files in Program Files folder. What about now ? Is that problem gone in Windows 7 ? IF NOT, then, how can I make the connection string dynamic (setting programmatically) for Entity framework ? Although I extremely like to use Application.StartUpPath to be my data store as it is easy for maintainability.

    B P 2 Replies Last reply
    0
    • N Nadia Monalisa

      Hi, I developed a desktop application using SQL Compact, used Entity Framework. Now I see, Entity Framework's connection string is not that simple, it stored many information in the connection string in app.config file. So, I do not touch that file. But what I see, the database folder is user |DataDirectory| which is actually Application.StartUpPath. When I distribute my program to end users, will they be able to run my application where the database is in the program files folder ? I know it was not a problem for XP. But when Vista came, the 'User Account Control' feature prevented accessing any files in Program Files folder. What about now ? Is that problem gone in Windows 7 ? IF NOT, then, how can I make the connection string dynamic (setting programmatically) for Entity framework ? Although I extremely like to use Application.StartUpPath to be my data store as it is easy for maintainability.

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      Your setup routine could add write privileges to the users, either to the startup directory or to the file(s) of your database.

      1 Reply Last reply
      0
      • N Nadia Monalisa

        Hi, I developed a desktop application using SQL Compact, used Entity Framework. Now I see, Entity Framework's connection string is not that simple, it stored many information in the connection string in app.config file. So, I do not touch that file. But what I see, the database folder is user |DataDirectory| which is actually Application.StartUpPath. When I distribute my program to end users, will they be able to run my application where the database is in the program files folder ? I know it was not a problem for XP. But when Vista came, the 'User Account Control' feature prevented accessing any files in Program Files folder. What about now ? Is that problem gone in Windows 7 ? IF NOT, then, how can I make the connection string dynamic (setting programmatically) for Entity framework ? Although I extremely like to use Application.StartUpPath to be my data store as it is easy for maintainability.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        The data should not be in the program directory.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups