user776676
user776676

Reputation: 4385

Windows Forms app: How do I encrypt an SQL CE database used in a Windows app?

Is there an easy way to encrypt an SQL CE database that is provided with a Windows app? Without encryption, a user can just open the database directly and can see all data in it. I hope that with encryption, he will have to use the provided UI via the app and see only what he is allowed to see.

If encryption is not possible, how can I achieve the same objective?

Thanks.

Upvotes: 0

Views: 320

Answers (1)

pickypg
pickypg

Reputation: 22332

You can. Enable the encryption on the database level by creating the database with the syntax:

CREATE DATABASE "name" DATABASEPASSWORD 'password' ENCRYPTION ON

I retrieved this from MSDN. You can then access it like normal.

It's worth noting that if you do encrypt it, and you lose the password, then that database is gone.

Upvotes: 3

Related Questions