Search code examples
c#sqlvisual-studiosql-server-ce

How to use SQL Server Compact edition as embedded source in desktop application and also to bakup in application itself?


I'm using SQL Server Compact Edition version 4.0 in my WPF application using the .NET framework 4.0. Can I use my DB packed as embedded source within my application and also backup at certain time? Is this possible?


Solution

  • Yes, you can include it as an embedded resource, but you must write it to disk before you can use it from your app.

    You can backup by stopping all threads using the database and performing a file copy.