I was working on an application in C# that required a database. I have SQL Express on my computer, so naturally I thought to use that. However, I eventually thought about distributing the application once it was finished, but realized that most users aren’t going to have SQL Express installed on their computers.
I did some research (i.e., asked on Sitepoint), and heard about SQL Server Compact Edition. It is a compact edition (thus the name) of SQL Server, that is able to run in memory and store everything in a .sdf file. It doesn’t have stored procedures, as well as several more advanced features of SQL Server, but it is very useful for its intended use. The latest version of SQL Server CE is 3.5, which works with Visual Studio 2008.
Once you create a database in your project (with data -> add data source or something of the sort), you must add the following files to your project, located in C:\program files\Microsoft SQL Server Compact Edition\v3.5 (replace 3.5 with the version of SQL Server Compact Edition you installed):
- sqlceca35.dll
- sqlcecompact35.dll
- sqlceer35EN.dll
- sqlceme35.dll
- sqlceoledb35.dll
- sqlceqp35.dll
- sqlcese35.dll
In the above filenames, replace 35 with 30 if you are using 3.0. Either way, they should be the only .dll files in that directory.
Once you do that, you can use it just like you would use SQL Server. Just use the namespace System.Data.SqlServerCe. You can then use the classes such as SqlCeConnection.
Similar Posts:
- Free Upgrade to Visual Studio 2008 Professional
- Renaming Files Dynamically in Bash — Kind of
- Creating the Business and Data Layers
- Knowing the Elements
- Setting Permissions in rsync
If you enjoyed this post, make sure you subscribe to my RSS feed!
Tags: .NET, databases, Programming, SQL Server, Visual Studio






































[...] I mentioned recently, I was looking at including a database with a Windows application. I had downloaded SQL Server [...]