title: System.Data.SqlClient.SqlException: Invalid column name 'Faculty_Id'
body: <p>Controller:</p>
  
  <pre><code>public async Task&lt;ActionResult&gt; Create([Bind(Include = "Id,Terms,Semester,Sections,Course,CreditHourTheory,CreditHourLab,Labinstructor,Faculty,Rooms,Day,Date,TimeStart,TimeEnd")] TimeTable.Models.TimeTable timetable)    
      {
  
          if (ModelState.IsValid)
          {
              db.TimeTable.Add(timetable);
              await db.SaveChangesAsync();
              return RedirectToAction("Create");
          }
          return View(timetable);
  
      }
  </code></pre>
  
  <p>In the view i have use the dropdown to get the value from the database and to insert this selected value in the another table in database</p>
  
  <pre><code>@Html.DropDownList("FId", null, String.Empty, new { @class = "form-control input-md cc2", @disabled = "disabled", @required = "" })
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>[Table("TimeTable")]
  public class TimeTable
  {
      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
  
      public string Terms { get; set; }
      public string Semester { get; set; }
  
  
      public int SectionsId { get; set; }
  
      [ForeignKey("SectionsId")]
      public Sections Sections { get; set; }
  
      public int CourseId { get; set; }
  
      [ForeignKey("CourseId")]
      public Course Course { get; set; }
  
      public string CreditHourTheory { get; set; }
  
      public string CreditHourLab { get; set; }
  
      public int? LabInstructorId { get; set; }
      [ForeignKey("LabInstructorId")]
      public Faculty Labinstructor { get; set; }
  
      public int FacultyId { get; set; }
      [ForeignKey("FacultyId")]
      public Faculty Faculty { get; set; }
  
      public int RoomId { get; set; }
      [ForeignKey("RoomId")]
      public Rooms Rooms { get; set; }
  
  
      public string Day { get; set; }
  
      public DateTime Date { get; set; }
  
      public TimeSpan TimeStart { get; set; }
  
      public TimeSpan TimeEnd { get; set; }
  }
  </code></pre>
  
  <p>Server Error in '/' Application.</p>
  
  <p>Invalid column name 'Faculty_Id'.
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.</p>
  
  <p>Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'Faculty_Id'.</p>
  
  <p>Source Error:</p>
  
  <p>Line 54:             {</p>
  
  <p>Line 55:                 db.TimeTable.Add(timetable);</p>
  
  <p>Line 56:                 await db.SaveChangesAsync();</p>
  
  <p>Line 57:                 return RedirectToAction("Create");</p>
  
  <p>Line 58:             }</p>
  
  <p>Source File: c:\Users\NoorMuhammad\Documents\Visual Studio 2013\Projects\TimeTable\TimeTable\Controllers\HomeController.cs    Line: 56</p>
  
  <p>Stack Trace:</p>
  
  <p>[SqlException (0x80131904): Invalid column name 'Faculty_Id'.]
     System.Data.SqlClient.SqlCommand.b__24(Task<code>1 result) +1792654
     System.Threading.Tasks.ContinuationResultTaskFromResultTask</code>2.InnerInvoke() +81
     System.Threading.Tasks.Task.Execute() +45
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter<code>1.GetResult() +24
     System.Data.Entity.Utilities.CultureAwaiter</code>1.GetResult() +123
     System.Data.Entity.Core.Mapping.Update.Internal.d__0.MoveNext() +1068
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter<code>1.GetResult() +24
     System.Data.Entity.Utilities.CultureAwaiter</code>1.GetResult() +71
     System.Data.Entity.Core.Mapping.Update.Internal.d__0.MoveNext() +676</p>
  
  <p>[UpdateException: An error occurred while updating the entries. See the inner exception for details.]
     System.Data.Entity.Core.Mapping.Update.Internal.d__0.MoveNext() +1044
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter<code>1.GetResult() +24
     System.Data.Entity.Utilities.CultureAwaiter</code>1.GetResult() +66
     System.Data.Entity.Core.Objects.d__3d<code>1.MoveNext() +1138
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter</code>1.GetResult() +24
     System.Data.Entity.Utilities.CultureAwaiter<code>1.GetResult() +66
     System.Data.Entity.Core.Objects.&lt;SaveChangesToStoreAsync&gt;d__39.MoveNext() +619
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.ConfiguredTaskAwaiter.GetResult() +24
     System.Data.Entity.SqlServer.&lt;ExecuteAsyncImplementation&gt;d__9</code>1.MoveNext() +457
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter<code>1.GetResult() +24
     System.Data.Entity.Utilities.CultureAwaiter</code>1.GetResult() +66
     System.Data.Entity.Core.Objects.d__31.MoveNext() +1165</p>
  
  <p>[DbUpdateException: An error occurred while updating the entries. See the inner exception for details.]
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter<code>1.GetResult() +24
     TimeTable.Controllers.&lt;Create&gt;d__8.MoveNext() in c:\Users\NoorMuhammad\Documents\Visual Studio 2013\Projects\TimeTable\TimeTable\Controllers\HomeController.cs:56
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
     System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +61
     System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass37.&lt;BeginInvokeAsynchronousActionMethod&gt;b__36(IAsyncResult asyncResult) +66
     System.Web.Mvc.Async.WrappedAsyncResult</code>1.CallEndDelegate(IAsyncResult asyncResult) +47
     System.Web.Mvc.Async.WrappedAsyncResultBase<code>1.End() +136
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
     System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49
     System.Web.Mvc.Async.AsyncInvocationWithFilters.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3d() +117
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass46.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3f() +323
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass46.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3f() +323
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass46.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3f() +323
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass33.&lt;BeginInvokeActionMethodWithFilters&gt;b__32(IAsyncResult asyncResult) +44
     System.Web.Mvc.Async.WrappedAsyncResult</code>1.CallEndDelegate(IAsyncResult asyncResult) +47
     System.Web.Mvc.Async.WrappedAsyncResultBase<code>1.End() +136
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
     System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2b.&lt;BeginInvokeAction&gt;b__1c() +72
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass21.&lt;BeginInvokeAction&gt;b__1e(IAsyncResult asyncResult) +185
     System.Web.Mvc.Async.WrappedAsyncResult</code>1.CallEndDelegate(IAsyncResult asyncResult) +42
     System.Web.Mvc.Async.WrappedAsyncResultBase<code>1.End() +133
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
     System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
     System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34
     System.Web.Mvc.Async.WrappedAsyncVoid</code>1.CallEndDelegate(IAsyncResult asyncResult) +70
     System.Web.Mvc.Async.WrappedAsyncResultBase<code>1.End() +139
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
     System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
     System.Web.Mvc.Controller.&lt;BeginExecute&gt;b__15(IAsyncResult asyncResult, Controller controller) +39
     System.Web.Mvc.Async.WrappedAsyncVoid</code>1.CallEndDelegate(IAsyncResult asyncResult) +62
     System.Web.Mvc.Async.WrappedAsyncResultBase<code>1.End() +139
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
     System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
     System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
     System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39
     System.Web.Mvc.Async.WrappedAsyncVoid</code>1.CallEndDelegate(IAsyncResult asyncResult) +70
     System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
     System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
     System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
     System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129</p>
  
  <p>Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34274 </p>