0

Is data backup and restore functionality possible in SQL Server Compact 3.5 SP2 edition ?

I have developed and installed a C# desktop application which is working perfectly. My app can store and manipulate data.

Now I want to backup that data stored in the SQL Server Compact 3.5 SP2 which is embedded to my application. I also want to produce reports from the data already stored.

Can anyone say:

IS IT POSSIBLE OR NOT ? IF POSSIBLE CAN YOU , PLEASE, GIVE ME A LINK OF WALK THROUGH TO DO THAT.

Thank You

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Zia_BD
  • 1
  • 3
  • Yes - sure - just copy the `.sdf` file to some other place ... SQL Server Compact has all its data and metadata stored inside this single `.sdf` file - just copy it - that's your backup – marc_s Mar 05 '13 at 17:40
  • Please don't use caps, try to use the markup tags instead to draw attention to a certain sentence or make your post more readable. – Jos Vinke Mar 05 '13 at 17:47
  • possible duplicate of [Take 'Backup' of SQL Server Compact database](http://stackoverflow.com/questions/2294656/take-backup-of-sql-server-compact-database) – Robert Levy Mar 06 '13 at 01:38

1 Answers1

0

According to MSDN, you just copy the file to make a backup, and same for a restore. You can view the documentation here. It's at the very bottom of the page.

The code is really easy:

System.IO.File.Copy(sourceFileName, destFileName);

Here's another SO post about this topic which will tell you that you have to not be using the .sdf file when you backup / copy else it'll be locked.

Good Luck!

Community
  • 1
  • 1
Mike C.
  • 3,024
  • 2
  • 21
  • 18