Click here to Skip to main content
14,573,826 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello;

It seems that SDF data files get corrupted rather easily, and repairing them clears the data. Is there any way to safeguard against this. What do you recommend, please.

Thank you.
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

If you mean the SDF files used by SQlCE / Sql Server Compact, then all I can say is that I have been using them for years, and never had a corrupted file. Indeed, a quick google on the subject shows only your post here, so it can't be all that bad.

And I would have thought it unlikely that repairing a DB file would deliberately lose all the data - repair applications generally err on the "save-it-anyway-he-might-need-it" side of things rather than the "that-bit-is-odd-so-I'll-delete-these-records" side. I would suspect that the corruption is destroying the data.

Is it possible that you are corrupting the file yourself? Do you do anything odd with it? Or open with a different application?
   
Comments
serendipity seven 11-Apr-13 14:15pm
   
Ok, Thanks, I'll keep trying (and check on your comments. It's sure that I'm doing something wrong.
Thanks again
OriginalGriff 11-Apr-13 14:19pm
   
You're welcome - good luck!
serendipity seven 12-Apr-13 2:54am
   
I think I know what was happening. In debug mode, the programme was getting confused when the SDF file in the project root directory was different from that in the debug/bin directory. Eliminating the latter resolved the issue (at least so it seems).
OriginalGriff 12-Apr-13 3:36am
   
Move it: Don't rely on data files in your app folder (you may not have the required write permissions on the folder in production, and it's a bad idea to store data below the "Program Files" folder anyway, as it is not likely to be on a regular backup schedule.
Have a look here:
http://www.codeproject.com/Tips/370232/Where-should-I-store-my-data
It suggests some better places.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100