Reputation: 5084
My C# project connects to SQL Server to save and retrieve data. What's the process to deploy such a project so that I could install the application on another PC? And how do I include the database tables that already contain previously made entries?
My windows application uses a SQL Server database to save user information and retrieve. Should I include a SQL Server installation along with the built project in order to run in on another PC?
Thank you!
Upvotes: 0
Views: 1277
Reputation: 1647
Assuming you are at the point you want to deploy your code, here are possible steps you can follow:
Upvotes: 0
Reputation: 5223
The easy stuff first.
1) If you are using Entity Framework you can enable migrations (if u havent done it already) and then when you point your connection string to another server Entity seed method will take care of everything.
Read about EF migrations HERE.
2) If you are not using EF then you have to backup and restore the database to the new server. you can use SQL Server Management Studio to export your DB (or only database schema without data) and then import it to the other server.
UPDATE After the comments addition:
No you cant just "include" the SQL Server installation in your app. SQL Server is a huge monster that comes in its own installation.
IF you are looking for a lightweight database that you could install in a pc, you can use:
-Access
-SQL Server Express (a crippled SQL Server)
-SQL Server Compact You can install it directly via nuget ( Microsoft.SqlServer.Compact package)
SQL server editions comparison
Personally i love the following combination on simple apps:
SQLite + Dapper (micro ORM, somethign like a very light Entity Framework)
Upvotes: 1