具有数据库连接的部署C# [英] Deployment C# with Database connection
问题描述
我已经有一个正在运行的应用程序,它具有数据库连接并且想对其进行部署
我尝试了很多事情.所以这就是为什么我现在要问的是,有一个简单的指南可以按照我在其中看到的操作去做.
我的连接字符串是硬编码的,在部署应用程序之后,它仍然是硬编码的,如何使数据源(计算机名称)自动更改为安装它的新计算机名称的方法是什么?
(返回@数据源= KONING-AF02EAF7 \ SQLEXPRESS;初始目录= KringVrienden;集成安全性= True";)
SofwareI'm正在使用:
Visual Studio2008.
SQL Server 2005
SQL管理服务器2005
请帮帮我.
Dennis,
I''ve a application running now with a database connection and wanna make a deployment of it
I tried much things. So that''s why I''m asking now is there a easy guide to follow where I can see what to do.
My connection string is hard coded, after I deployed the application it''s still hard coded what is the way to let the Data Source (Computer Name) change automaticly to the new computername where it is installed?
(return @"Data Source=KONING-AF02EAF7\SQLEXPRESS;Initial Catalog=KringVrienden;Integrated Security=True";)
SofwareI''m using:
Visual Studio 2008.
SQL Server 2005
SQL Management Server 2005
Please help me.
Dennis,
推荐答案
连接字符串应存储在配置文件中,除非存在安全问题.
可以同时应用于Web和WinForm应用程序.
读写配置文件 [
Connection string should be stored in the config file unless there is a security issue with that.
That can be applied for both Web and WinForm application.
Read and Write Configuration file[^]
它是在应用程序(winForm)中的类中制成的.
./SQLEXPRESS在本地主机上运行.但是,为什么不在其他主机上呢?
It''s made in a class in the application (winForm)
./SQLEXPRESS that''s working on localhost. But why not on a other host?
这篇关于具有数据库连接的部署C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!