title: Entity Framework: An error occurred while updating the entries
body: <p>I know there's a lot of questions about it but i've read like 20 of them and couldn't find answer for me. I have this error </p>
  
  <blockquote>
    <p>"An exception of type
    'System.Data.Entity.Infrastructure.DbUpdateException' occurred in
    EntityFramework.dll but was not handled in user code</p>
    
    <p>Additional information: An error occurred while updating the entries.
    See the inner exception for details."</p>
  </blockquote>
  
  <p>When I go to InnerException it says </p>
  
  <blockquote>
    <p>"Invalid object name 'dbo.Samochodies'."</p>
  </blockquote>
  
  <p>. I don't know what the hell is this because i don't have any '<code>Samochodies</code>' in my program.. Anyway, that's the code:</p>
  
  <p>CarsController.cs</p>
  
  <pre><code>public ActionResult Create([Bind(Include = "Id,Brand,Model,Price,Bought,Sold")] Samochody car)
      {
          if (ModelState.IsValid)
          {
              baza.Cars.Add(car);
              baza.SaveChanges(); //error here
              return RedirectToAction("Index");
          }
          return View(car);
      }
  </code></pre>
  
  <p>Samochody class</p>
  
  <pre><code>public class Samochody
  {
      public int Id { get; set; }
      public string Brand { get; set; }
      public string Model { get; set; }
      public decimal Price { get; set; }
      public DateTime Bought { get; set; }
      public DateTime Sold { get; set; }
  
      public class CarDBCtxt : DbContext
      {
          public DbSet&lt;Samochody&gt; Cars { get; set; }
      }
  </code></pre>