How to add foreign keys to compact database in VS2010?

If I create a SQL Express database through VS2010, I can create diagrams and thus establish foreign key relationships. What happens in a compact database? In Server Explorer, there is no such option for this type of database.

+4
source share
2 answers

Yes there is. In Server Explorer, right-click on the table, select Table Properties, and use Add Relations . Remember to click the Add Link button to actually add an exemption

+5
source

Walkthrough: Creating a SQL Server Compact 3.5 Database

To create a relationship between tables created in the previous procedure

  • In Server Explorer / Database Explorer, expand the table.
  • Right-click the Orders table and select Table Properties.
  • Click Add Relationships.
  • Enter FK_Orders_Customers in the Relationship Name field.
  • Select CustomerID from the column list of the foreign key table.
  • Click Add Columns.
  • Click Add Link.
  • Click “OK” to complete the process and create the link to the database.
  • Click OK again to close the Table Properties dialog box.
0
source

Source: https://habr.com/ru/post/1444066/


All Articles