在安装过程中导入数据库 [英] Importing database during install
问题描述
你好,
我刚刚开始进行C#编程,并且在考虑部署时遇到了一个问题.
我的应用程序使用Microsoft SQL数据库(.mdf/.ldf).当然,这在我的计算机上运行良好,当然,已经安装了SQL Server并且已经创建了db.
我想要将数据库合并到我的项目中,以便它可以在任何需要的地方使用它.例如:我在另一台计算机上安装了该应用,并且该应用使用的是程序本身包装的数据库.
因此,基本上我需要在安装过程中搜索ms sql文件夹,然后在其中复制文件,然后重新启动sql server或类似的东西.
我希望这是有道理的:)
Hello,
I just started C# programming and I have a question considering deployment.
My application uses Microsoft SQL database (.mdf/.ldf). This works fine on my computer, of course, where SQL server is already installed and db is already created.
What I would like is to incorporate database in my project so that it can use it anywhere it wants. e.g.: I install app on another computer and it uses database that is packed within the program itself.
So basically I would need to do a search for ms sql folder during installation, copying files there and then restarting sql server or something similar.
I hope this makes some sense :)
推荐答案
是的,每个用户都可以拥有自己的用户,但是所有人都可以获取存储在该数据库中的一些基本信息. />
我现在想到的唯一替代方法是从SQL 2005进行安装检查,然后当有人启动应用程序时检查数据库是否存在...如果不存在,则执行sqlcommand来构建数据库...
yes, each user would get his/her own, but all would get some basic information stored in that database.
Only alternative I could think of now is installation check fro SQL 2005 and then when someone starts application check if database exists...if not, then do sqlcommand to build one...
这篇关于在安装过程中导入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!