none
Database not updated RRS feed

  • Question

  • I'm using MS C#2010 express and SQL server 2008, tried to create  a simple project with SQL database with simple method such as insert, edit. 

    When the program running, i can access database and modifiy, however when i closed program and MS C#, after that open the program again, the database not updated. I tried  Entity data model, Dataset to connect, but i got the same result.  The database not updated.

    Pls help.

    • Moved by Bob Beauchemin Saturday, July 9, 2011 3:06 AM Moving to the most appropriate forum (From:.NET Framework inside SQL Server)
    Friday, July 8, 2011 9:01 AM

Answers

  • Hi Hungdoan;

    If you added a database to the project then most likely the problem is that you set it to "Copy To Output Directory". What this does in the development environment system is to copy the database file to the bin directory each time the program starts which over writes the last copy that was there when you last ran the program with the not modified version of the DB in your project. Click on the link above to read about it. You may want to set that property to "Do Not Copy" so that it always uses the one in the project folder.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by VMazurModerator Saturday, July 9, 2011 11:37 AM
    • Marked as answer by hungdoan Wednesday, July 13, 2011 1:57 AM
    Saturday, July 9, 2011 5:02 AM

All replies

  • Hi Hungdoan;

    If you added a database to the project then most likely the problem is that you set it to "Copy To Output Directory". What this does in the development environment system is to copy the database file to the bin directory each time the program starts which over writes the last copy that was there when you last ran the program with the not modified version of the DB in your project. Click on the link above to read about it. You may want to set that property to "Do Not Copy" so that it always uses the one in the project folder.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by VMazurModerator Saturday, July 9, 2011 11:37 AM
    • Marked as answer by hungdoan Wednesday, July 13, 2011 1:57 AM
    Saturday, July 9, 2011 5:02 AM
  • thank you very much

     

    Wednesday, July 13, 2011 1:57 AM
  • Not a problem, glad to help.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Wednesday, July 13, 2011 3:13 AM
  • Thanks to all the participators.
    Wednesday, July 13, 2011 5:10 AM
    Moderator