Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9058641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:46:29+00:00 2026-06-16T14:46:29+00:00

I am teaching myself about the entity framework using a tutorial found at http://msdn.microsoft.com/en-us/data/jj591506

  • 0

I am teaching myself about the entity framework using a tutorial found at http://msdn.microsoft.com/en-us/data/jj591506. I am working with the code below.

using (var db = new DatabaseEntities())
{
        var section = new Section
        {
            SectionID = 1,
            SectionName = "Bob"
        };
        db.Sections.Add(section);
        db.SaveChanges();
}

For some reason this code is not writing to my database. No error are being thrown. Do you have ideas what I could look at or what could be the cause? This is an almost exact copy of the example give on the MSDN page linked above.

This problem looks very similar to what is happening in this question: Entity Framework not actually saving changes unfortunately the person who answered this question did not explain how they got resolved the problem. They explained that they checked the SQL going over to the database, and it was fine, after some investigation, turned out that they had a copy of the database within the project, which was over-riding the one in the output when it was rebuilt. My problem is I don’t know how to stop this occurring. Can you help?

I have also looked at:

  • Entity framework saving context
  • Entity Framework: Attached Entities not Saving
  • many pages from Google.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:46:30+00:00Added an answer on June 16, 2026 at 2:46 pm

    So I end up taking the advice above an creating a new project unfortunately that did not work. 10 hours of Googling later and I found the solution. I a suspected the database was being rebuilt.

    To prevent a database being rebuilt right click on it in the solution explorer and go to properties. Under properties find the property Copy to output directory and change the value to Do not copy.

    This actually broke my code because the database was not in the output directory. To get the program to work again I had to manually put a copy of the database in my debug directory. For my project. In Windows 8 with Visual Studio 2012 this was located at:

    %UserProfile%\Documents\Visual Studio 2012\Projects\PROJECTNAME\PROJECTNAME\bin\Debug
    

    Hope this saves others searching the Internet for hours on end.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am teaching myself about the entity framework using a tutorial found at http://msdn.microsoft.com/en-us/data/jj591506
I'm teaching myself some Django tonight using the local dev package at instantdjango.com I
I am currently teaching myself about various data strutures and am a little frustrated
I am teaching myself about web programming. I am trying to create a user
My disclaimer here is that I started teaching myself C++ about a week ago
Teaching myself the flow of data from mySQL -> PHP -> JSON / Javascript
I'm teaching myself Rails through PragProg's (apparently outdated - I'm using Rails 3.2.3) Rails
Ok, I've been teaching myself PHP and doing little projects for about 40 hours,
I have started teaching myself about the Android NDK and I have followed this
I just started teaching myself Linq to SQL today. I hardly know anything about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.