title: Entity framework not adding new record
body: <p>I have some code to add a new record to the database however, it does not appear to update the database.</p>
  
  <pre><code>private void btnNew_Click(object sender, EventArgs e)
         {
              DBEntities db = new DBEntities();
              Animal a = new Animal();
              a.AnimalName = txtNew.Text;
              db.SaveChanges();
              Debug.WriteLine(a.AnimalName);
          }
  </code></pre>
  
  <p>It is worth mentioning that I have also set one of the properties of my database to 'copy if newer' and that did not fix the problem. My connection string which was automatically generated when I created the model is as follows:</p>
  
  <pre><code>&lt;add name="DBEntities" connectionString="metadata=res://*/AnimalModel.csdl|res://*/AnimalModel.ssdl|res://*/AnimalModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\dbAnimal.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient"/&gt;
  </code></pre>
  
  <p>If anyone knows of a solution it would be most appreciated. Thank you.</p>