Mdf文件只是准备好了 [英] Mdf file is ready only

查看:117
本文介绍了Mdf文件只是准备好了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中有一个完全脱机运行的Windows应用程序。我使用SQL Server作为后端,并在我的应用程序中使用.mdf,.ldf文件进行数据库访问。



创建安装文件时,我们在安装文件中添加了这些文件我用vs安装程序创建了安装文件。并在客户端电脑上安装sql express。



现在问题是当我们在客户端计算机上安装安装文件时它会在

中创建一个文件夹

C:/'默认公司名称'

但每次我们必须通过windows安全选项授予这些文件的权限。我们有什么方法可以为所有人分配权限吗?



我尝试过:



i使用app.config文件夹下面的连接字符串连接数据库

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>

推荐答案

AttachDBFileName 是邪恶的,请看这个问题:

怎么做我在visual stadio 2015中连接旧版数据库 [ ^ ]
AttachDBFileName is evil, see this question:
How do I connect to old version database in visual stadio 2015[^]


您不应该将数据文件保存在C:\Program Files中,请参阅我应该在哪里存储数据? [ ^ ]。
You should not be saving data files in C:\Program Files, see Where should I store my data?[^].


这篇关于Mdf文件只是准备好了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆