简体   繁体   English

如何在Visual Studio 2010中使用我的设置和部署项目部署SQL Server数据库?

[英]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.

相关问题 如何将SQL Server 2008 R2数据库添加到Visual Studio 2010安装文件中? - How to add my SQL Server 2008 R2 database to my Visual Studio 2010 Setup File? 如何在项目设置中添加SQL Server数据库 - How can I add SQL Server Database in my project setup Visual Studio 2010数据库项目部署 - Visual Studio 2010 Database Project Deployment 如何在Visual Studio 2010中使用SQL Server 2012数据库打包和部署C#桌面应用程序? - How to package and deploy a C# desktop application with a SQL Server 2012 database in Visual Studio 2010? 如何在Visual Studio 2010安装和部署项目中包括第三方exe? - How to include third party exe in visual studio 2010 setup and deployment project? 如何在未安装Office 2010的计算机上安装带有MS Access数据库的Visual Studio 2010安装项目? - How to install visual studio 2010 setup project with MS Access database on a computer which is not having Office 2010 installed? 在Visual Studio中创建安装文件时,为什么不能连接到SQL Server数据库? - Why can't I connect to the SQL Server database when I create setup file in Visual studio? 如何使用SQL Server数据库在Visual Studio 2017中创建安装文件 - How to create setup file in Visual Studio 2017 with SQL Server database 作为Visual Studio 2010安装项目的一部分运行SQL脚本 - Running SQL script as part of visual studio 2010 Setup Project 如何在 Visual Studio 2010 的数据库中包含图像 - How do I include Images in my Database in Visual Studio 2010
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM