DataBinding

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


Answer this question

DataBinding

  • cVic

     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

  • J Cervero

    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 

  • kc1

    Thanks a million.Big Smile
  • averageJ

    Thank you Jonsey! I have been stuck on this for a while.
  • AllanHO

    This solution produces an error

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

    Any thoughts


  • DataBinding