views:

96

answers:

5

I created a small application using C# winforms that uses SQL Server as a database.

Is there a way to attach the database to the exe file so I won't need to install SQL Server on all the machines that I want to run the program on?

+11  A: 

As far as I know, that's where SQL Server Compact comes into play.

Quoting the Wikipedia article:

Unlike other editions of Microsoft SQL Server, SQL CE runs in-process with the application which is hosting it; while having a memory footprint of less than 2 MB;

Daniel Vassallo
+2  A: 

Have you seen SQL Server Compact?

It's a Zero-config, single file version of SQL Server.

kervin
+1  A: 

You can included it as part of the app installer. See this article

Ben Robinson
+6  A: 

in addition to sql server compact, there is also a c# port of sqlite that you could use.

Jason w
Speaking of SQLite, there is also a fairly feature-complete ADO.NET 2.0/3.5 provider for SQLite (namespace `System.Data.SQLite`) at http://sourceforge.net/projects/sqlite-dotnet2/.
stakx
I second System.Data.Sqlite. All you need to do is include a dll in your installer. The database exists in a single file.
ebpower
+1  A: 

You can use SQL Server compact: http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx

or SQLite: http://www.sqlite.org/ - it has a .NET library that you can download and use...it's pretty fast and compact

bojanskr