Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open database diagram in Visual Studio 2017

In Visual Studio 2017, I can not make relations between tables using database diagram.

How to open database diagram in Visual Studio 2017?

like image 516
Mahmoud Abo Elsoud Avatar asked Jan 31 '18 04:01

Mahmoud Abo Elsoud


People also ask

How do I create a database diagram in Visual Studio?

Open a new database diagram Right-click the Database Diagrams node of your database in Object Explorer. From the drop-down menu, click New Database Diagram. In the Add Table dialog box, choose tables to work with in the diagram. The Database Diagram menu will be added to the main menu and the designer pane will open.

How to open database diagram XSD in Visual Studio 2019?

Database diagrams in xsd format can be opened in Visual Studio. I Created and worked with Database Diagram xsd format using Visual Studio 2019 (can do same in VS 2017) in the following manner: - Select main menu View > SQL Server Object Explorer to connect and view the desired SQL database objects.

How to visualize a database?

To visualize a database, you can create one or more diagrams illustrating some or all of the tables, columns, keys, and relationships in it. You can open Database Diagram Designer by opening a new or existing diagram.

How do I open a database diagram in Azure SQL?

Applies to: SQL Server (all supported versions) Azure SQL Database Azure SQL Managed Instance Analytics Platform System (PDW) You can open database diagrams to view or edit the diagram's structure. In Object Explorer, expand the Database Diagrams folder. Double-click the name of the database diagram you want to open.


2 Answers

Database diagrams in xsd format can be opened in Visual Studio.

I Created and worked with Database Diagram xsd format using Visual Studio 2019 (can do same in VS 2017) in the following manner: -

  1. Open Visual Studio and create a new C# console application (you can also use VB)
  2. Go to “Solution Explorer” and right click on the Project and choose Add > New Item from sub-menu

enter image description here

  1. from the pop up window, choose Visual C# project type as "Data" and select Dataset

enter image description here

  1. Select main menu View > SQL Server Object Explorer to connect and view the desired SQL database objects.
  2. Connect using credentials to view database objects like Views, tables etc.
  3. To draw the database diagram, drag the required tables to the Dataset Pane

enter image description here

like image 78
rchacko Avatar answered Nov 07 '22 17:11

rchacko


As per this similar question on MSDN, the database diagrams have been deprecated after Visual Studio 2012.

The answer there provides two workarounds:

  1. You can use SQL Server Management Studio (SSMS) to work with Database diagrams, here is a download link.

  2. You can add a item (ADO.NET Entity Data Model) to project, it will create for you a .edmx file which contains a table with relation. More in here.

like image 42
Pac0 Avatar answered Nov 07 '22 15:11

Pac0