且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用sql server 2008数据库在C#windows应用程序中创建安装文件?

更新时间:2023-10-14 10:51:16

你没有 - 在Visual Studio中创建一个新的安装和部署项目,它会对依赖项进行排序。

见这里: Google应用程序部署VS 2012 [ ^ ]



但请注意,不要在安装中包含SQL Server。原因有两个:

0你好吗? n仅出于版权原因分发SQL Server Express - 而不是SQL Server完整版。

1)他们可能已在网络上安装了SQL Server。如果是这样,那么他们可能会想要使用该版本。

2)如果他们确实安装了SQL服务器并且你开始扩散SQL服务器Express实例,那么你将会惹恼数据库管理员...

3)SQl Server的单站点安装比用户控制下的一些分散版本更有可能被备份。

4)对于普通用户来说,安装和管理Sql服务器非常复杂 - 这不是一个好主意!

5)它将破坏使用Sql Server而不是SqlCE或SQLite的主要优势 - 多用户访问。如果每个人都安装了自己的SQL服务器副本,那么您将拥有数据库的多个副本,每个副本由一个人使用。这会引起一些混淆,并且(取决于你如何编写原始数据库)可能需要花费相当大的努力才能在问题实现时组合成单个实例。
You don't - you create a new Setup and Deployment Project in Visual Studio and it sorts out the dependencies.
See here: Google "application deployment VS 2012"[^]

But do note that you should not include SQL Server in your installation. There are a couple of reasons:
0) You can only distribute SQL Server Express for copyright reasons - not SQL Server full version.
1) They may already have SQL Server installed on the network. If so, then they will presumably want to use that version.
2) If they do have SQL server installed and you start proliferating SQL server Express instances, you are going to annoy the heck out of the database administrator...
3) A single site installation of SQl Server is a lot more likely to be backed up than a number of scattered version under user control.
4) Sql server is quite complex for a "normal" user to install and administer - it is not a good idea!
5) It will destroy the primary advantage of using Sql Server over SqlCE or SQLite - multiuser access. If everyone installs their own copy of SQL server, then you will have multiple copies of your database, each used by a single person. This will cause some confusion, and (depending on how you wrote the original database) may take some considerable effort to combine into a single instance when the problem is realized.