简体   繁体   中英

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. I have created the setup and deployment project for this application which produces the .exe file and installs the application on a client 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.

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)

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.

Could anybody please help me in doing this as I am new to C#, I have already spent many days on it.

Thanks in advance

You should do some steps to gain your goal.

1: Create Setup project for your application.
2: Place SQL Server 2008R2 setup files in software disk.
3: Install Microsoft SQL Server 2008R2 using command prompt. You can learn more about installing SQL Server using command prompt from Here
4: Install your application.
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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM