如何使用sql server数据库部署c#windows应用程序 [英] How to deploy c# windows application with sql server database

查看:131
本文介绍了如何使用sql server数据库部署c#windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家,

我正在使用visual studio 2010,c#4.0和sql server 2008做一个Windows应用程序。我已经完成了我的项目和测试。现在我想用sql server数据库部署我的项目,以便我的客户端在安装我的软件时,安装向导在本地机器上配置数据库,创建数据库,创建所有必需的表和存储过程。



我该怎么做?请逐步建议我,因为我是新手。

Dear Experts,
I am doing a windows application using visual studio 2010, c# 4.0 and sql server 2008. I have already finished my project and testing. Now i want to deploy my project with sql server database so that my client when install my software, installation wizard configure database on local machine, create database, creates all required tables and stored procedures.

How can i do this? Please suggest me step by step process as i am new to this.

推荐答案

Hi Sunil,



请检查以下链接。可能这些链接可以帮助您解决问题。



http://www.mssqltips.com/sqlservertip/2971/creating-a-visual-studio-database-project-for -an-existing-sql-server-database /

http://www.theengineeringprojects.com/2013/01/creating-database-in-microsoft-visual.html

http://thedatafarm.com/data-access/attaching-an -mdf-database-to-localdb-in-visual-studio-the-easy-way /
Hi Sunil,

Please check following links. May be these links could help you to solve your problem.

http://www.mssqltips.com/sqlservertip/2971/creating-a-visual-studio-database-project-for-an-existing-sql-server-database/
http://www.theengineeringprojects.com/2013/01/creating-database-in-microsoft-visual.html
http://thedatafarm.com/data-access/attaching-an-mdf-database-to-localdb-in-visual-studio-the-easier-way/






如果您使用SQL服务器开发,那么您需要在客户端安装它。



如何顶部部署:



1.现在你可以创建一个背面你的数据库并在客户端的SQL服务器上恢复它

2.如果你使用了一些ORM,那么你可以从中生成数据库(但不是存储过程和函数)

3你可以提供一个脚本备份你的数据库,并要求客户端在他的sql服务器上运行它,你可以在exe中修补相同的内容并在应用程序启动时运行那些sql如果表不存在。



SQL Server备份还原: http://msdn.microsoft.com/en -us / library / ms187048.aspx [ ^ ]



ORM(实体框架)创建数据库: http://www.entityframeworktutorial.net/code-first/database-initialization-strategy-in-code-first.aspx [ ^ ]



数据库SQL脚本生成: http://msdn.microsoft.com/en-IN/library/hh245282.aspx [ ^ ]
Hi,

if you developed using SQL server then you need to install it at client end.

How top deploy :

1. Now you can create a backup your DB and restore it at client's SQL server
2. If you using some ORM then your could generate you DB from it (but not store procedure and functions)
3. You can provide a script back up of your DB and ask client to run that on his sql server, you can patch the same within the exe and run those sql's on app start if tables not exists.

SQL Server backup Restore : http://msdn.microsoft.com/en-us/library/ms187048.aspx[^]

ORM (Entity Framework) Create DB : http://www.entityframeworktutorial.net/code-first/database-initialization-strategy-in-code-first.aspx[^]

Database SQL Script Generation : http://msdn.microsoft.com/en-IN/library/hh245282.aspx[^]


你可以使用visual studio或者类似安装盾的方法为你的解决方案创建安装项目。

i建议你如果你的应用程序能够使用sql server express 2008你可以轻松创建安装项目和使用visual studio安装项目使您的sql express bootstrap自动安装在客户端系统上。然后在客户端第一次启动应用程序时创建创建数据库和表的向导,或者复制数据库然后在app.config中引用连接字符串。
you can create setup project for your solution, using visual studio or something like install shield.
i suggest you if your application is capable using sql server express 2008 you can easily create setup project and makes your sql express bootstrap to install automatically on your clients systems using visual studio setup project. then create wizard for creation db and tables on your first start of your application on client side or copy your db then refer your connection string in your app.config.


这篇关于如何使用sql server数据库部署c#windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆