user1317277
user1317277

Reputation: 113

C# application using SQL Server database

This might sound a silly question but I've really spend hours in trying to find a solution...

I have a local database on SQL Server and it is used with a C# application.. The only way I view the database is through SQL Server.. It is accessible and altered in my application when I am running the application on my developing PC, but when I run it on another PC the database is not found (obviously) .. How can I include the database sources when I am compiling the program, (so that it would be also found when I run it on other PCs) ?

Initially I used SQL Server CE and I achieved portability, but I had to include stored procedures, and this edition doesn't accept them :/ so I had to turn my attention to the latter type.

Sorry for my terrible English ! :(

Thanks in advance

Upvotes: 2

Views: 782

Answers (2)

vcsjones
vcsjones

Reputation: 141678

How can I include the database sources when I am compiling the program, (so that it would be also found when I run it on other PCs) ?

You can't. SQL Server license prohibits distributing parts of it like that, plus there is no documented way to do that. If you need SQL Server on the box, it needs to come from the installer. You can create an installer for your own product, and your installer can install SQL Server if it's needed as a prerequisite.

Alternatively, you could look at other database options such as SQLite for a file-based database. You can distribute the components of SQLite.

Upvotes: 7

user957902
user957902

Reputation: 3060

If you need a local sql server on each pc where your application runs then you should look into the Express edition of MS SQL Server. It is the free with limitations version of MS SQL Server.

Upvotes: 0

Related Questions