如何在asp.net中本地连接sql server到另一台计算机 [英] How to connect sql server to another computer locally in asp.net

查看:176
本文介绍了如何在asp.net中本地连接sql server到另一台计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

这里我的系统有窗口7 64位在这里我安装sql SERVER现在我想连接另一台计算机。两台计算机连接局域网连接。如何连接另一台计算机访问数据库。我没有静态ip ok.t​​hen我如何访问。



我尝试过:



这里我试过SQL Server配置管理器。单击TCP / IP协议并执行启用,然后重新启动我的sql服务。然后重新启动TCP / IP属性并检查IPALL端口,然后转到该端口的防火墙创建规则。但没有使用它。

Hi to all,
Here my system have window 7 64 bit here i install sql SERVER now i want to connect another computer. Two computer connected with LAN connection.How to i connect that another computer to access database . i dont have static ip ok.then how i access.

What I have tried:

here i tried in SQL Server configuration manager. Click TCP/IP Protocol and do Enable and then i restart my sql service.and then that TCP/IP properties and check IPALL Port and then go to Firewall create rule for that PORT. but no use of this.

推荐答案

使用SQL Server实例名称而不是IP。这将为您提供如下连接字符串:

Use the SQL Server instance name instead of an IP. This will give you a connection string like:
Data Source=PCNAME\SqlExpress;Initial Catalog=NameOfDatabase;Integrated Security=True;Pooling=False

或类似。

因为你提到C#:

尝试使用Server Explorer窗格在VS中建立连接:

1)打开服务器资源管理器。

2)右键单击数据连接并选择添加连接

3)在随后的对话框中,选择您的DataSource和数据库,指定安全信息,然后按测试连接按钮。

4)连接工作时,按确定

5)在服务器资源管理器窗格中突出显示数据库,并查看属性窗格。将显示连接字符串的工作示例,您可以将其复制并粘贴到您的应用程序或配置文件中。

or similar.
Since you mention C#:
Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.


这篇关于如何在asp.net中本地连接sql server到另一台计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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