连接位于另一个程序中的数据库 [英] connect database located in another program

查看:88
本文介绍了连接位于另一个程序中的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想在另一个程序中连接到数据库
我使用此代码

 connection.ConnectionString =  @" ; 



但是要连接到另一个程序中的数据库,我必须放置什么而不是"localhost"?

在此先感谢:)

解决方案

尝试这个

添加名称="Constr"; connectionString =数据源=服务器名称的路径(它可能是您的LAN远程服务器);初始目录=数据库名称;持续安全信息=真实;用户ID =使用ID;密码=密码;" providerName =" System.Data.SqlClient


希望它可以帮助连接字符串参考 [ ^ ]

:)


有关任何ConnetionString,请访问:

http://www.connectionstrings.com/ [ ^ ]

单击您正在使用的数据库服务器并获取连接字符串...


hi
I want to connect to database in another program
I use this code

connection.ConnectionString = @"Server=localhost;Integrated Security=SSPI";



but what I have to put instead of "localhost" to connect to database that are located in another program ?

thanks in advance :)

解决方案

Trythis one

add name="Constr" connectionString="Data Source=path of server name(its may be your LAN Remote server );Initial Catalog=Database name; Persist Security Info=True;User ID=useid;Password=password;" providerName="System.Data.SqlClient


Hope it helps The Connection String Reference[^]

:)


For any ConnetionString, visit:

http://www.connectionstrings.com/[^]

click on Database Servers that you are using and get the connection string...


这篇关于连接位于另一个程序中的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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