Hi All,
I have recently installed Sql server 2005 on my machine and i am trying to connect to database for retreiving table information.
but it is giving me below error :
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.Sql Client.SqlExcep tion: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source Error:
Line 18:
Line 19: SqlConnection cnn = new SqlConnection(C onnectionString );
Line 20: cnn.Open();
Line 21: SqlCommand cmd = new SqlCommand();
Line 22: cmd.CommandType = CommandType.Tex t;
My Code is this :
[code=cpp]
string ConnectionStrin g = ConfigurationMa nager.AppSettin gs["ConnectionStri ng"];SqlConnection cnn = new SqlConnection(C onnectionString );
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Tex t;
cmd.Connection = cnn;
DataSet ds = new DataSet();
cmd.CommandText = "select Title from HumanResources. Employee";
SqlDataReader reader = cmd.ExecuteRead er();
[/code]
and in the webconfig File i have the ConnectionStrin g like this:
[code=xml]
<appSettings>
<add key="Connection String" value="server=B BMATRIXONE\SQLS ERVER2005NEW;Da tabase=Adventur eWorks;UID=sa;P WD=*******;pool ing=true"/>
</appSettings>
[/code]
How to solve this error, please help me.
Thanks
-john
I have recently installed Sql server 2005 on my machine and i am trying to connect to database for retreiving table information.
but it is giving me below error :
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.Sql Client.SqlExcep tion: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source Error:
Line 18:
Line 19: SqlConnection cnn = new SqlConnection(C onnectionString );
Line 20: cnn.Open();
Line 21: SqlCommand cmd = new SqlCommand();
Line 22: cmd.CommandType = CommandType.Tex t;
My Code is this :
[code=cpp]
string ConnectionStrin g = ConfigurationMa nager.AppSettin gs["ConnectionStri ng"];SqlConnection cnn = new SqlConnection(C onnectionString );
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Tex t;
cmd.Connection = cnn;
DataSet ds = new DataSet();
cmd.CommandText = "select Title from HumanResources. Employee";
SqlDataReader reader = cmd.ExecuteRead er();
[/code]
and in the webconfig File i have the ConnectionStrin g like this:
[code=xml]
<appSettings>
<add key="Connection String" value="server=B BMATRIXONE\SQLS ERVER2005NEW;Da tabase=Adventur eWorks;UID=sa;P WD=*******;pool ing=true"/>
</appSettings>
[/code]
How to solve this error, please help me.
Thanks
-john
Comment