从另一台计算机访问mssql数据库 [英] accessing mssql database from a different computer

查看:157
本文介绍了从另一台计算机访问mssql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在笔记本电脑上安装了mssql数据库,并创建了一个c#应用程序

,用于存储数据并将数据检索到数据库中。这是正常工作,我尝试创建一个对等网络,并在第二台计算机上安装c#应用程序,并尝试访问第一台笔记本电脑上的SQL数据库,但无法访问它。请任何人帮我配置。



这是使用的连接字符串

i have installed mssql database on my laptop and i have created a c# application
that stores and retrieve data into the database. this is working normally, i try creating a peer to peer network and installed the c# application on the second computer and try accessing the sql database on the first laptop but was not able to access it. please can any one help me out with the configuration.

this is the connection string used

SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
            conn.ConnectionString = "Data Source=USER-PC;Initial Catalog=CENTRALDB;User ID=sa;Password=mike";
            conn.Open();

推荐答案

SQL Server必须启用远程连接,请参阅:

配置远程访问服务器配置选项 [ ^ ]

教程:如何在SQL Server 2008中启用远程连接? [ ^ ]



有时需要更改Windows防火墙设置:配置Windows防火墙以允许SQL Server访问 [ ^ ]
SQL Server must enable remote connections, see:
Configure the remote access Server Configuration Option[^]
tutorial: How to enable remote connections in SQL Server 2008?[^]

Sometimes it is necessary to change windows firewall settings: Configure the Windows Firewall to Allow SQL Server Access[^]


这篇关于从另一台计算机访问mssql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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