locked
DataBinding RRS feed

  • Question

  • I am going through the Learning Resources by Bab Tabor.  Lesson 9 is about databinding.  The culmination of the whole lesson developing a simple application where you can use a form to change data in the original SQL database.  When I build my own program based on the specific example outlined in the lesson, the changes I make in the form are never updated into the original database.  So, I go and download the solution and the same thing happens, the data in the original database (in the example MyCompany) is never updated. 

    Any guidance?
    Sunday, November 27, 2005 7:55 PM

Answers

  •  Mable wrote:
    There are actually two copies of the database: one in the app directory, which is the one you work with from the IDE, and one in the output directory, which is the one you work with when the program is running. By default, VB copies the app version to the output directory whenever you start your program. Then you make your changes and save them. All is well, until you restart the program. Then the app version gets copied again and wipes out your changes.

    The solution is to select your database.mdf file in the solution explorer, and set its "copy to output" property to "do not copy". You may need to do some manual copying if you want to make changes via the IDE, but your runtime changes will be preserved.

    --Mable 


    Setting it to "copy if newer" works
    Thursday, December 1, 2005 9:18 PM

All replies

  • There are actually two copies of the database: one in the app directory, which is the one you work with from the IDE, and one in the output directory, which is the one you work with when the program is running. By default, VB copies the app version to the output directory whenever you start your program. Then you make your changes and save them. All is well, until you restart the program. Then the app version gets copied again and wipes out your changes.

    The solution is to select your database.mdf file in the solution explorer, and set its "copy to output" property to "do not copy". You may need to do some manual copying if you want to make changes via the IDE, but your runtime changes will be preserved.

    --Mable 
    Tuesday, November 29, 2005 4:45 AM
  • This solution produces an error

    An attempt to attach an auto-named database for file..........

    Any thoughts?
    Thursday, December 1, 2005 8:07 PM
  •  Mable wrote:
    There are actually two copies of the database: one in the app directory, which is the one you work with from the IDE, and one in the output directory, which is the one you work with when the program is running. By default, VB copies the app version to the output directory whenever you start your program. Then you make your changes and save them. All is well, until you restart the program. Then the app version gets copied again and wipes out your changes.

    The solution is to select your database.mdf file in the solution explorer, and set its "copy to output" property to "do not copy". You may need to do some manual copying if you want to make changes via the IDE, but your runtime changes will be preserved.

    --Mable 


    Setting it to "copy if newer" works
    Thursday, December 1, 2005 9:18 PM
  • Thanks a million.Big Smile
    Friday, December 2, 2005 2:38 AM
  • Thank you Jonsey!  I have been stuck on this for a while.
    Monday, August 21, 2006 12:14 AM