Data lost from .mdf file as I exit application

前端 未结 2 632
攒了一身酷
攒了一身酷 2021-01-16 20:53

Recently I work on SQL Server 2008 R2 database. I create database and attach .mdf file of same database in my application with some default data in it . Run application defa

相关标签:
2条回答
  • 2021-01-16 21:26

    As mention by @Henk , @Microtechie , I scan my project folder and found there are 3 copies of .mdf file are there, 1st in project folder where code project([ProjectFolder ]) resides 2nd in [ProjectFolder]/bin/debug folder and 3rd in [ProjectFolder]/bin/release folder and suddenly solution to my que trigger in my mind. Problem not in multiple .mdf files in project folder, as I every time ‘Clean’ and ‘Build’ my solution new copy of .mdf file from [ProjectFolder] get copied into [ProjectFolder]/bin/debug folder, result in override of last .mdf file in same folder. Hence every time I build and run application only default data coming and last added and updated data get lost. Thanku all for your replies and precise answer..!

    0 讨论(0)
  • 2021-01-16 21:28

    What kind of object do you load your .mdf file data into? It is likely that you need to save the changes in that object before closing the application.

    0 讨论(0)
提交回复
热议问题