Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Windows application in C# that completely runs offline. I have used SQL Server as backend and use .mdf, .ldf files in my application for database access.

While creating setup file we have added these files in setup file.here i have created setup file using vs installer. and also install sql express in client pc.

Now the problem is when we install setup file in client computer it creates a folder in

C:/'Default Company Name'
but every time we have to give permissions to these files through windows security option. Is there any way we can assign permissions once for all?

What I have tried:

i am using below connection string from app.config folder to connect with database
<connectionStrings>
   
    <add name="conString" connectionString="Data Source=(LocalDB)\v11.0; AttachDbFilename=C:\Program Files\MYsetup\MYdatabase.mdf;Integrated Security=True;Connect Timeout=30"/>
  </connectionStrings>
Posted
Updated 16-Jul-17 22:53pm

AttachDBFileName is evil, see this question:
How do I connect to old version database in visual stadio 2015[^]
 
Share this answer
 
You should not be saving data files in C:\Program Files, see Where should I store my data?[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900