C# Database - 10 Creating a database part 2: Can not make a change to database fields.

Posted by Anonymous December 11, 2007 - 12:30pm

I followed "10 Creating a database part 1 & 2". I got the perfect result of showing book details. After I make a change to field, ex. change author name, I click on save button of BindingNavigator. After closing application, I run it again, what I had changed disappear. Author name turn back to original one!

Did I miss something?

Posted by Anonymous December 11, 2007 - 1:22pm

I found the solution.

- I selected copy database into project environment that make vc# to copy .mdf into my project directory.
- At Solution Explorer I see Books.mdf. In its properties "Copy to Output Directory" --> "Copy always" was selected. That mean every time I run my application, the original database will be copy to my output directory!! Everything I had changed last time I ran will be replaced.
- Solution is change property value from "Copy always" to "Copy if newer"