使用 sql server 数据库部署 C# 应用程序? [英] C# application deployment with sql server database?

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

问题描述

谁能告诉我使用 SQL Server 数据库部署 C# 应用程序的准确方法?我想在客户端的机器上运行我的应用程序,它正在我的机器上运行,但在客户端的机器上显示错误.我已经在客户端的机器上安装了 SQL Server 2012.我对部署知之甚少,因为我是第一次这样做.我知道需要先附加 .mdf 文件.请告诉我部署的确切步骤,以便我能够在客户端的机器上运行我的应用程序.我需要提到的是,该应用程序是基于 Windows 的简单应用程序!

Can anyone tell me the accurate way of deployment my C# application with a SQL Server database? I want to run my application on client's machine, it is running on my machine but showing error on client's machine. I have already installed SQL Server 2012 on client's machine. I know little about deployment as I am doing it for the first time. I know there is a need to attach .mdf file first. Please tell me the exact steps of deployment so that I am able to run my application on client's machine. The thing I need to mention is that the application is simple windows based application!

推荐答案

1 - 将数据库附加到 SQL Server 实例(使用 .mdf 和 .ldf 文件或使用数据库备份)

1 - Attach database to the SQL Server instance (Either using .mdf and .ldf files or using a DB backup)

2 - 在客户端机器上部署应用程序之前更改您的连接字符串.如果您没有配置文件并且对连接字符串进行了硬编码,则必须更改连接字符串以反映客户端的机器名称、SQL 实例名称和数据库名称,并在部署前编译应用程序.

2 - Change your connection string before deploying the application in client machine. If you don't have a config file and you've hard coded the connection string then you'll have to change the connection string to reflect client's machine name, SQL Instance name and DB name and compile the application before deploying.

您可以参考以下 URL 以了解如何配置您的连接字符串.

You may refer to the following URL to get an idea how to configure your connection string.

http://www.connectionstrings.com/sql-server/

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

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