Search code examples
sql-server-ce-4

Password protecting an existing SQL Server Compact 4 database file


Can someone tell me how to password protect an existing SQL Server CE 4 file?


Solution

  • In the SqlCeEngine.Compact method, specify a password. Or you can use SqlCeCmd from a command line:

    sqlcecmd40 
    -d "Data Source=C:\test.sdf;" 
    -z "Data Source=;Password=secret"