views:

109

answers:

2

I'm working on a school project desktop application in c# using Visual Studio 2010 (.NET 4.0) and the application uses a SQL Server 2008 database that's running on a SQL Server instance on the development machine I'm working with.

My question is how do I package up the database with the c# project so that the application works no matter what machine I'm using it on regardless of whether the machine it's installed on has SQL Server installed or not?

Thank you.

+1  A: 

use SQL Server Compact Edition (SQL CE)

Flakron Bytyqi
@Flakron: Can you give me a link for reference on how to package a SQL Server CE database with a C# project/solution using Visual Studio 2010? Ideally I'd like to be able to copy my solution folder onto a usb flash drive and be able to open and run my solution on another PC in Visual Studio 2010 and for me to be able to do that the database has got to move along with my solution folder some how yet the connection string needs to remain the same for the database.
Ryan
The moment you add a reference to your project, the referenced dll will be copied to your bin folder. So your project will most likely work without a problem, even on other pcs.Here you have a simple tutorial on how to use SQL Server CE.http://arcanecode.com/2007/04/13/sql-server-compact-edition-with-c-and-vbnet/
Flakron Bytyqi
A: 

If it's not a web application and it's making a direct use of the database, how is it going to work without an instance of SQL server running?

I'd make an .msi for the application and I'd write a SQL script for installing the database and populating it with the data.

You can use SQLServer tools for scripting the tables and the data.

vikp