Click here to Skip to main content
13,149,756 members (57,909 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have one application which is created in WPF. In that application it is require to setup database in that PC.

So I have created setup such that it check at time of installation MS SQL install or not. If installed then create database and execute table and store procedure script so it will setup database.

now what my concern is about security, How we can secure my code of database script and table. because it is on client PC so I don't want anybody can see database logic.

so can anybody help to work around this stuff.

Thanks in advance.
Posted 23-Apr-13 3:26am
Updated 23-Apr-13 5:17am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can not really hide data, and structure if you deploy database to the client. SQL Server has encryption features[^] from Enterprise edition on, but I doubt you will deploy such thing to the users. With any other edition, the database file is transportable, thus attaching it to an other instance where the user has administrator privileges will grant full access. But in general even this is unnecessary.
You can however encrypt database of SQL CE on file system level using EFS[^] (see:[^]) or the new built-in features:[^].

All approaches have their limitation.

This is also a really useful, but complex literature in this topic:[^]
TechnoGeek001 23-Apr-13 10:54am
Thanks Zoltan for taking time.

one more thing want to add the database will be large so I can't use the SQL CE and other database tool like Access which provide the database file. On the database very complex logic written in it is so storeprocedure is the best way to do this. That's why I have choose SQL Server database tool.

Is compact edition provide large data management ?
Zoltán Zörgő 23-Apr-13 13:24pm
If you require both large database files (above 4GB and 10GB respectively)and stored procedures neither CE or Express is good for you (see:
There are other (free) RDBMS implementations that can be used as local database, that do not have such size limits, have some sort of encryption and provide you .net support - but probably without stored procedures. Please note, that in such cases stored procedures will bring you little or no advantage at all - you can easily replace them with Linq to Entities based managed methods in you Business Logic layer. Why? Besides the fact, that you can make a real managed BL - because your stored procedures would run on the same machine (maybe even without any compilation). So you consume the same resources, not like with real client/server situations when your sp runs on the server.
The best practice you can currently follow is to choose a proper (embedded, lightweight) RDBMS, use the database only as data store, build an EF model on top of it and a complete BL on top of the model.
I suggest you look around here: and find a proper embedded edition database management system with EF support, and probably some chyper too. Please not, that the filesystem (EFS) based encryption will work with most of them.
TechnoGeek001 24-Apr-13 0:47am
Thanks for valuable comment.I will give 5 start for this comment because it us useful to me.

but I am thinking If database size not increase more then 10 GB then can I use the local DB (”Denali”)?

IF we use localdb as database file then In the localDB can we prevent the database file by some password to connect it so to local db we can connect only through application not from external appliation.

so does this make sense what I am thinking?

Zoltán Zörgő 24-Apr-13 2:13am
LocalDB is stand-alone application, thus it is not bound to your application. The newly introduced self-contained security model can help you. Please see here:
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can encrypt your procedures using WITH ENCRYPTION:


This is NOT 100% secure, but it's better than nothing..
TechnoGeek001 23-Apr-13 9:57am
Thanks for you quick reply. Yes I have this idea in my mind to secure the storeprocedure this way. but I have doubt to secure other objects like table and functions.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 23 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100