我正嘗試使用下面給出的代碼從數據庫中選擇不同的行。當我運行這個查詢時,它不會返回我所期望的結果。我需要不同的城市名稱到下拉控制。 using (var context = new CountryEntities())
{
var city = (from u in context.Cities
where u.StateId == StateID
昨天我在Management Studio中創建了數據庫,現在我想使用EF Code First在程序中創建它。 這裏是鏈接到我的數據庫:http://s11.postimg.org/6sv6cucgj/1462037_646961388683482_1557326399_n.jpg 而我所做的: public class GameModel
{
[Key]
public i
我在SQL Server Management Studio數據庫看起來是這樣的: 在EF它看起來像這樣: 所以基本上,當我添加一個Bokningar行我需要RumsBokningar表包含的Bokning_ID和Rum_ID房間。這裏是我的代碼: var model = new HotellEntities();
model.Bokningar.Add(new Bokningar
控制器: using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication1.Models;
using System.ComponentModel.DataAnnotations.Schema;