在其他系统中获取Sql Sever的连接字符串 [英] Getting Connection String Of Sql Sever In Other Systems

查看:92
本文介绍了在其他系统中获取Sql Sever的连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我编写数据库程序并且要在另一个系统中使用它时,必须更改程序的连接字符串才能在该系统中运行它.对于此问题,我如何获取服务器名称,用户ID和sql传递我在我的代码中将程序安装在系统服务器上吗?我知道我可以使用

when i write a database program and i want to use it in another system i must change the connection string of my program to run it in that system.for this problem how can i get server name,user id and pass of sql server of the system i installed my program on it in my code?? i know i can use

SqlConnectionStringBuilder



但我不想获取服务器名称,用户ID,来自用户的通行证

TIA



but i dont want to get server name,user id,pass from user

TIA

推荐答案

您无法从任何电子来源获取用户ID或密码-在那里可以阻止未经授权使用该系统的人员获得访问权限,因此获取它们的简单方法没有多大意义.您认为在银行卡的正面大写PIN码是个好主意吗?

您可以获取可用服务器的列表-这非常简单-但是您必须要求某人提供访问详细信息,以使用他们选择的任何服务器.
You can''t get the user ID or password from any electronic source - there are there to stop people who aren''t authorised to use the system gaining access, so a simple method to get them does not make much sense. Would you think it a good idea to print your PIN number in large digits on the front of your bank card?

You can get a list of available servers - that''s pretty easy - but you have to ask someone for the access details to use whichewver one they select.


在运行脚本时,创建应用程序在sql Server的客户端实例上使用的数据库,还应该创建具有适当权限的用户,这些用户可以同时访问该数据库.然后,您应该具有所有必要的信息,以便在适当的设置文件中创建正确的connectionStrings.
When you run the script that creates the database your application uses on the clients instance of sql server, you should also create the appropriate users with their permissions that can access that database at the same time. You then should have all the necessary information to create the correct connectionStrings in the appropriate settings file.


这篇关于在其他系统中获取Sql Sever的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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