远程访问SQL Server 2008时出错 [英] Error while remote access to sql server 2008

查看:76
本文介绍了远程访问SQL Server 2008时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决此错误消息:

建立与SQL Server的连接时发生与网络相关或特定于实例的错误.找不到服务器或无法访问服务器....

How to solve this error message:

network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible....

推荐答案

检查是否分配远程连接.
允许远程连接
然后使用

Check whether you allo remote connection or not.
allow remote connections
and then use

<add key="con" value="Data Source=10.11.1.13;Initial Catalog=omx;Persist Security Info=True;/></pre></xml>"></add>


确保您的数据库服务器处于&在网络上.

< add key ="con" value =数据源= 10.11.1.13; database = database_name; uid = userid; pwd = password;"></xml>>
make sure your database server is on & on network.

<add key="con" value="Data Source=10.11.1.13;database=database_name;uid=userid; pwd=password;"></xml>">


尝试以下方法之一,

1)将sql server端口添加到连接字符串中:
Try out one of the following,

1)Add the sql server port to the connection string:
Server=YourSQLSRVR,10000;Database=YourDatabase;User ID=User;Password=?????????


2)
1.您的SQl浏览器已关闭
2. SQLServer Configuration Manager中的协议> SQL Server 2005网络配置> SQL Express的协议(例如TCP/IP,命名管道)已禁用.

分辨率.

只需启动SQL Browser.
启用协议.
重新启动SQL Express服务.


3)您的电脑名称\ SQLEXPRESS

u复制此名称并将其粘贴为asp.net框架的Web配置文件为


2)
1. Your SQl Browser is off
2. Protocols under SQLServer Configuration Manager > SQL Server 2005 Network Configuration > Protocols for SQL Express like TCP/IP, Named Pipes are disabled.

Resolution.

Just Start SQL Browser.
Enable the Protocols.
Restart SQL Express service.


3)your pc name\SQLEXPRESS

u copy this name and paste it in the web config file of your asp.net framework as

<connectionStrings>
<add name="this name is as your wish" connectionString="server=your pc name\\SQLEXPRESS; catalog= your database name;SSPI=true; providerName="System.Data.SqlClient" "/>
</connectionString>
this section comes under <appSettings/>


然后您在您的aspx.cs代码文件中将此字符串连接称为


then u call this string connection in ur aspx.cs code file as

// Create the Connection object.
string connectionString =
WebConfigurationManager.ConnectionStrings["this name is as your wish"].ConnectionString;
SqlConnection con = new SqlConnection(connectionString);


然后您打开连接并按您的目的使用,并确保使用后关闭连接

我希望这可以解决问题


then u open the connection and use for your purpose and make sure that u close the connection after use

I hope this might resolve the problem


这篇关于远程访问SQL Server 2008时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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