0

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!

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

I read that before but i don't now how to make it work.can you give me an example?
I found how to make it work but i used an absolute path for database. I would like to use a relative path instead, for after deploying my application.How can i do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.