How do I tie a database into my C# application?

We are creating a data driven C# application and we would like to use the power and functionality (normalized database, stored procs, etc..) of SQL Server Express, but the data that is held in the database is in essence going to make up a large portion of the source code to our application. Is there a way to embed or compile the database into the application so that the end user that installs the application from a CD will not be able to view the data

If this cannot be done via SQL Server Express is there another tool that can be used to reach the same goal of having a database accessible by our program but not viewable to the end user



Answer this question

How do I tie a database into my C# application?

  • Visual Basic Nov.

    Basically I'm looking for something similar to a CodeBase database but a Microsoft solution. Does such a thing exist
  • telectro

    There are ways to secure the database content and lock it down so that only the very experienced people will be able to look inside. These include encrypting the stored procedures and the data inside, as well as adjusting the security systems for the files.

    These functions are going to be specific to the database and you will get a better answer by posting a similar question to the SQL Server forums. For what I understand (I have not tried it yet) the SQL Server 2005 system has some added functions and systems that can assist with this that have been improved since the release of SQL Server 2000.



  • R Gatliff

    This is an option, but it only provides limited protections. The database would still be accessible by the DBA of the server or anyone that has the equivalent of system admin rights to the SQL Server.

    This database would be installed on customer computers via a CD install. I/my company will not be physically installing the database or have ownership of the server and thus will not have the ability to remove access to the database by other accounts.


  • Iulian Popescu

    You can store any sort of binary data in a resources file that will be built into your assembly. I am not sure what the security implications are with this approach, but you can start here for more info:

    http://msdn2.microsoft.com/en-us/library/ekyft91f(en-US,VS.80).aspx

    Michael Blome

    Visual C# Documentation Team


  • BraBo

    You can secure the database with a password.

  • How do I tie a database into my C# application?