且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

退出应用程序时 .mdf 文件中的数据丢失

更新时间:2022-05-28 01:17:47

正如@Henk, @Microtechie 提到的,我扫描了我的项目文件夹,发现那里有3个.mdf文件副本,第一个在项目文件夹中代码project([ProjectFolder ]) 在 [ProjectFolder]/bin/debug 文件夹中排名第二,在 [ProjectFolder]/bin/release 文件夹中排名第三,突然解决了我的问题.问题不在项目文件夹中的多个 .mdf 文件中,因为我每次清理"和构建"我的解决方案时,来自 [ProjectFolder] 的 .mdf 文件的新副本被复制到 [ProjectFolder]/bin/debug 文件夹中,导致覆盖同一文件夹中的最后一个 .mdf 文件.因此,每次我构建和运行应用程序时,只会丢失默认数据以及最后添加和更新的数据.谢谢大家的回复和准确的回答..!

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..!