开发者

How can I add a foreign key from a table in another database connection?

I have set up a ASP.net MVC application which uses the default forms authentication. It uses the ASPNETDB.mdf like shown here:

How can I add a foreign key from a table in another database connection?

I then set up another database connection which is similar to the NerdDinner.mdf file开发者_如何学Python above.

I have a post that belongs to a user. It has a UserId value which needs to be a foreign key to the information in ASPNETDB.mdf. When I go to add a foreign key, I can only see information with regards to the table I made. How do I go about doing this?


Even if it were possible (which is isn't), this would be a bad idea - chaining databases in this manner would only cause problems down the line.

  • If one database is down, so is the other.
  • If the network between database servers (assuming different servers), both are down.

From MSDN:

A FOREIGN KEY constraint can reference columns in tables in the same database or within the same table.

(emphasis mine)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜