7

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

How to open database diagram in Visual Studio 2017?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

2 Answers2

7

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

rchacko
  • 1,965
  • 23
  • 24
4

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.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Pac0
  • 21,465
  • 8
  • 65
  • 74