Coding tips, programming hacks and sharing knowledge.
1. Open a visual studio project to which you want to add a database.
2. Right click on your solution in the Solution Explorer. From the context menu that opens up, select "Add" > "New Project".
3. Add New Project dialog box opens up. From the Installed tab, select SQL Server and name your database. Click OK.
4. An database project is added to your solution explorer.
5. Right click on the database in the Solution Explorer. From the context menu that opens up, select "Import" > "Database'.
6. Import Database dialog box opens up. Click on "New Connection".
7. A Connection Properties dialog box opens up. Select a Server name from the drop down or alternatively type in a Server name. Leave the "Use Windows Authentication" radio button checked in the Log on to the server section.In the Connect to a database section, select a database name from the "Select or enter a database name".
8. Click "Test Connection". If the connection is successful, click OK.
9. You will now return to the Import Database dialog box. Leave everything else as default and click "Start".
10. You will now see a progress bar while visual studio populates the database project with your database.
11. Finally, click "Finish".
12. The database project in visual studio is now successfully populated with your SQL database.
Learn how to backup a database using SQL Server Management Studio in 15 easy steps
We recently started using database project in our application. To get the updated stored procedures from database project to destination database we were using "Buil...