Encrypting the SQL Server CE database

The SQL Server CE database comes with an encryption utility that allows the entire content of the .SDF file to be encrypted.

Should I worry about performance?

The performance cost of activating encryption is negligible, so you don't have to worry about enabling it.

You can specify to encrypt the SQL Server CE database by specifying the Encrypt Database=true setting when creating the database using the sqlCeEngine class.

_dbcreationstring = "Data source='" + _sDFPath + "';

LCID=1033;Password='admin123'; Encrypt database= TRUE;";

_engine = new sqlCeEngine(_dbcreationstring); try

_engine.CreateDatabase(); catch (Exception ex)

throw ex; finally


You can modify the code in the CreatesalesForceDatabase method that you've created during Chapter 2 in sQLserverPlugin.PluginClass. When you enable encryption, you must also ensure that a valid Password has been specified. The database will be encrypted using this password value.

There is no difference in terms of the code used to connect to the database. As long as you've included the same password in your connection string, you will be able to access the database:

Data source='\My Documents\salesforce.sdf'; Password=admin123;

Was this article helpful?

0 0

Post a comment