I am working with SQL Server and I want to set the Database password of a SQL Server CE Database (*.sdf). I found the Command how I can create a new database with password:
CREATE DATABASE "secure.sdf"
DATABASEPASSWORD '<enterStrongPasswordHere>'
But I want to set a password of an existing db.
You need to use the Compact API of SqlCeEngine API
http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.compact(VS.80).aspx
SqlCeEngine engine = new SqlCeEngine("Data Source = db.sdf");
engine.Compact(null);
engine.Compact("Data Source=; Password =pass;");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With