I'm trying out Visual Studio 2012 and so far it's good but I created database project, added database *.mdf file to my App_Data and tried to create simple database with relations and I have no clue what to do next. I can't even name my database.
http://msdn.microsoft.com/en-us/library/hh272680(v=vs.103).aspx - AFAIK this article shows how to add relations but I can't find any Foreign Keys
node. And also, why can't I edit name? VS2010 database management was so easy and intuitive, now I don't understand how to work with it.
More visual representation of my question and my simple table for example.
1) Open the SQL Server Object Explorer toolbox using View | SQL Server Object Explorer from Visual Studio. 2) Drill down to the Databases node, then to your database, then to Tables. 3) Right-click and select Add New Table… 4) Visual Studio creates a new table called "Table" and opens it in the Table designer.
Right-click on Tables and select Add New Table. The Table Designer opens and shows a grid with one default row, which represents a single column in the table that you're creating. By adding rows to the grid, you'll add columns in the table.
To modify table data through a view. In Object Explorer, expand the database that contains the view and then expand Views. Right-click the view and select Edit Top 200 Rows. You may need to modify the SELECT statement in the SQL pane to return the rows to be modified.
Table name you can change in Properties
window:
relations by right clicking on Foreign Keys
:
You can also modify sql in lower pane - all changes will be reflected in graphical tools. I'm find this useful e.g. when I want to copy some columns from one table to another.
You can also make changes on database with another tools, like SSMS (better FK tools I think) and then import this changes via Schema Compare
by setting database as source and project as destination.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With