简体   繁体   中英

Backup SQL Server CE database with C# - Import-Export

I have created a C# windows application with vs2010 and I'm using a SQL Server CE database. I'm looking for a way to backup my database programmatically.

Is there a way to export/import my entire database (as a .sdf file) or just copy it to another location and then import it and replace the current one?Could anyone provide me the code in order to do this?

I'm relatively new to this but I'm guessing this is not something as difficult as it sounds. I couldn't find a clear answer anywhere so any help would be appreciated!

File.Copy will do the job, I believe. You can get the full path from the SqlCeConnection.Database property

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM