如何在客户端上使用 sql server 数据库部署应用程序 [英] How to deploy application with sql server database on clients

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

问题描述

我为我的客户设计了一个账户软件.我将 SQL Server 2008 数据库与存储过程一起使用.它是在 Visual Studio 2010、.NET Framework 3.0 中开发的.我有超过 500 个客户端使用 Windows 7.

I have designed an accounts software for my clients. I used SQL Server 2008 database with Stored Procedures. It is developed in Visual Studio 2010, .NET Framework 3.0. I have more than 500 clients using Windows 7.

主要问题是:

SQL Server 运行时是否随 .NET Framework 自动安装?由于 MS Access 数据库不需要在客户端上安装 Office.

Is SQL Server runtime automatically installed with .NET Framework? As MS Access database does not required Office to be installed on client.

我无法在每个客户端上安装 SQL Server 2008,这是一项艰巨的工作.此外,客户对安装过程没有很好的了解.

I can not installed SQL Server 2008 on each client, it is a tough job. Also the clients are not having a good knowledge of installation process.

如何在客户端上运行 SQL Server 数据库而不在客户端上安装其设置?是否有任何运行时文件或设置?

How to run SQL Server database on clients without installing its setup on clients? Is there any runtime files or setup?

推荐答案

Option 1 - Setup Project

使用 Visual Studio,您可以创建安装项目并安装安装过程中所需的先决条件.

Option 1 - Setup Project

Using Visual Studio you can create a setup project and install prerequisites that you need during installation.

安装过程非常简单,最终用户可以在点击下一步按钮后安装应用程序和先决条件.

The installation process is very simple and the end user can install application and prerequisites after clicking next buttons.

以下是创建设置项目的步骤:

Here are the steps for Creating a Setup Project:

1- 创建一个 c# Windows 窗体应用程序

  1. 创建 C# Windows 窗体项目
  2. 添加新项目并将 SQL Server 数据库添加到您的应用程序
  3. 向您的应用程序添加一个表并在其中填充一些数据
  4. 在主表单中显示数据.

2- 创建设置项目

  1. 添加新项目 → 设置和部署 → 设置项目
  2. 右键单击设置项目"和添加项目输出",然后从主项目中选择主要输出
  3. 右键单击设置项目"和添加项目输出",然后从主项目中选择内容文件
  4. 右键单击安装项目并单击属性,然后单击先决条件并选择 SQL Server Express
  5. 选择 .Net 框架
  6. 选择 Windows 安装程序
  7. 选择单选按钮从与我的应用程序相同的位置下载先决条件.
  8. 右键单击左侧窗格中的用户桌面并添加新快捷方式并选择应用程序文件夹、SampleApplication 的主要输出,然后单击确定并将快捷方式重命名为您需要的名称.
  9. 重建解决方案.
  10. 重建安装项目
  11. 转到安装项目的输出目录并运行 setup.exe

就这么简单.

有关更多信息,请查看以下文档文章:

For more information take a look at following docs articles:

  1. 如何:创建或添加安装项目
  2. 如何:在 Windows Installer 部署中安装先决条件
  3. 演练:在安装时使用自定义操作创建数据库

选项 2 - ClickOnce

使用 Visual Studio 的另一个选择是使用 ClickOnce 发布.

Option 2 - ClickOnce

Using Visual Studio another option is using ClickOnce publishing.

为此,在您的项目属性中,在发布选项卡中,单击先决条件按钮,您可以在先决条件中选择 SQL Express.这样,您只需要将数据库文件设置为复制到输出目录中,并在连接字符串中使用 AttachDbFileName:Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;初始目录=主".
有关更多信息,请查看以下文档文章:

To do so, in properties of your project, in publish tab, click prerequisites button, you can select SQL Express in prerequisites. This way, you only need to set your database files to copy in output directory, and use AttachDbFileName in connection string: Data Source=.SQLEXPRESS; AttachDbFilename=|DataDirectory|Database.mdf; Initial Catalog=Master".
For more information take a look at the following docs article:

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

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