Click here to Skip to main content
15,848,157 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every one

I have developed a windows base application by c# and SQL express mdf file as database;
I don't want anyone to access my database(tables)

what is the best way to protect the mdf file database so nobody access that?
is it possible to set user and pass that needed for connecting to database from every system and server?

Please help me
Richard MacCutchan 26-Aug-14 10:12am    
Add a password so the content is encrypted.

1 solution

Depending on the version of SQL you are using, you can apply Transparent Data Encryption (introduced at 2008) which means that once you have provided the encryption key all operations continue as if the DB was not encrypted:[^]

Be aware of a few things though:
1) The data is no longer encrypted once it leaves SQL server: so anyone monitoring the network can read it.
2) Backup data is not encrypted - so you need to secure that yourself. Backup files are, but any data created via SELECT commands is not. So "SELECT * INTO NewTableName" will not automatically encrypt the new table, unless it is also in an encrypted database.
3) If you lose your encryption key, you will not be able to recover the data.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900