質問

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. enter image description here

役に立ちましたか?

解決

Table name you can change in Properties window: table properties
relations by right clicking on Foreign Keys:
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.

他のヒント

Right click on the database where you like to execute the query and then select add new query and execute the following query in it.

sp_rename 'oldtablename','newtablename'

Not so far. Right clic on this element. enter image description here

check out this answer: Visual Studio 2012 Database Designer - Has the functionality changed?

I'm new to sql anyway if you right click the toolbar there is a "table designer" set of buttons but are all grayed out. Not sure if to initiate them the db must be Online.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top