客户端计算机的连接字符串更新 [英] Connection string update for client machine

查看:62
本文介绍了客户端计算机的连接字符串更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

准备好将桌面应用程序从开发人员计算机移动到客户端计算机时,是否需要将连接字符串实例从我的计算机名称更改为客户端计算机名称。使用MS提供的安装程序安装程序。



我尝试过:



尝试在为客户端计算机刻录副本之前更改连接字符串属性。试图通过使用客户端请求将程序放在某个驱动器和文件位置来连接。不起作用得到错误26这似乎是各种错误的错误号。错误无法定位实例。

When ready to move a desktop application from developer machine to client machine, do I need to change connection string instance from my machine name to client machine name.Using the setup installer provided by MS.

What I have tried:

tried to change the connection string property before burning copy for client machine. Tried to connect by using clients request to put program on certain drive and file location. does not work get error 26 which seems to be a error number for various errors.error is not able to locate instance.

推荐答案

这是典型连接的细分string



数据源= [数据库服务器的名称或IP];

初始目录= [数据库名称];

用户ID = [数据库访问uid];

密码= [数据库传递uid]



如果db在您的然后,您可能会发现从远程版本的程序访问数据库的问题。那样就是防火墙和权限等...



如果你不能通过连接字符串访问数据库,请确保你可以ping数据库服务器。
Here is a breakdown of a typical connection string

Data Source=[name or ip of the db server];
Initial Catalog=[database name];
User ID=[database access uid];
Password=[database pass uid]

If the db is on your machine then you may find issues accessing the database from a remote version of the program. That way lies firewalls and permissions etc...

If you can't access the db via the connection string, make sure you can ping the db server.


首先,您不必专门为连接字符串刻录副本 - 应该在配置文件中,以便您的应用程序不需要更改,并在安装时设置当您第一次检查或创建数据库时,时间(如果应用中的细节发生变化,可以更改它)。

用户应该知道 - 或者能够找出 - 什么是他的DBA中的SQL Server / MySQL实例的连接字符串详细信息,虽然可以通过查找SQL服务器实例来帮助他:

First off, you shouldn't have to "burn a copy" specifically for a connection string - that should be in a configuration file so your app does not need to change, and be set at installation time (with a way to change it if the details change in your app) when you check or create the DB for the first time.
The user should know - or be able to find out - what the connection string detail for his instance of SQL Server / MySQL from his DBA, though it is possible to "help" him by locating the SQL server instances:
SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
DataTable dt = instance.GetDataSources();
foreach (System.Data.DataRow row in dt.Rows)
    {
    Console.WriteLine("ServerName = {0}", row["ServerName"]);
    }

您不能 - 或者不应该 - 知道他的数据库的登录详细信息:它包含密码是有原因的!

You can't - or shouldn't - know the login details for his DB: it includes a password for a reason!


这篇关于客户端计算机的连接字符串更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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