[英]How can I deploy the SQL server database with my setup and deployment project in Visual Studio 2010?
My scenario : 我的情景:
I have a Windows Forms application in Visual Studio 2010 and a database in SQL Server 2008 R2. 我在Visual Studio 2010中有一个Windows窗体应用程序,在SQL Server 2008 R2中有一个数据库。 I have created the setup and deployment project for this application which produces the .exe
file and installs the application on a client PC. 我为此应用程序创建了设置和部署项目,该项目生成.exe
文件并在客户端PC上安装应用程序。 But it needs to install SQL Server 2008 R2 and create the database with the same name that we have in our pc then we generate the database script from my pc and run on the client pc on SQL Server 2008 R2, change the name of server in app.config
file, then it runs successfully. 但它需要安装SQL Server 2008 R2并创建与我们在PC中具有相同名称的数据库然后我们从我的PC生成数据库脚本并在SQL Server 2008 R2上的客户端PC上运行,更改服务器的名称app.config
文件,然后运行成功。
Here is the problem: 这是问题所在:
This is ok for single user but if I have many clients it will need that I do all the process for all the users. 这对单个用户来说是好的,但是如果我有很多客户端,则需要为所有用户执行所有过程。 eg (Install SQL Server on their Pc and configure it for my application) 例如(在他们的Pc上安装SQL Server并为我的应用程序配置它)
What I want : 我想要的是 :
I want to add my data base in set up so that I no need to install the SQL Server on client system and do all the steps. 我想在设置中添加我的数据库,这样我就不需要在客户端系统上安装SQL Server并执行所有步骤。
Could anybody please help me in doing this as I am new to C#, I have already spent many days on it. 任何人都可以帮我这样做,因为我是C#的新手,我已经花了很多天。
Thanks in advance 提前致谢
You should do some steps to gain your goal. 您应该采取一些措施来实现目标。
1: Create Setup project for your application. 1:为您的应用程序创建安装项目。
2: Place SQL Server 2008R2 setup files in software disk. 2:将SQL Server 2008R2安装文件放在软件磁盘中。
3: Install Microsoft SQL Server 2008R2 using command prompt. 3:使用命令提示符安装Microsoft SQL Server 2008R2。 You can learn more about installing SQL Server using command prompt from Here 您可以使用此处的命令提示符了解有关安装SQL Server的更多信息
4: Install your application. 4:安装您的应用程序。
5: Create your database using T-SQL code or copy .mdf and .ldf files with installer to application folder and attach that files using T-SQL code. 5:使用T-SQL代码创建数据库或使用安装程序将.mdf和.ldf文件复制到应用程序文件夹,并使用T-SQL代码附加该文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.