473,625 Members | 3,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error while establishing a connection to the server


Using Vs2005 sqlServer 2005

When i try to connect i get this 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)

Connection string:
<connectionStri ngs>
<add name="pubsConne ctionString1" connectionStrin g="Data Source=.;Initia l
Catalog=pubs;Us er=mk;pw=x"
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>

Calling code :

try
{
using (SqlConnection cn = new
SqlConnection(W ebConfiguration Manager.Connect ionStrings[0].ConnectionStri ng))
{
cn.Open();

}

}
catch (Exception ex)
{
Response.Write( ex.Message);
}
Jul 25 '06 #1
3 3609
You don't seem to be providing it with a data source to connec to.

"thom" wrote:
>
Using Vs2005 sqlServer 2005

When i try to connect i get this 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)

Connection string:
<connectionStri ngs>
<add name="pubsConne ctionString1" connectionStrin g="Data Source=.;Initia l
Catalog=pubs;Us er=mk;pw=x"
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>

Calling code :

try
{
using (SqlConnection cn = new
SqlConnection(W ebConfiguration Manager.Connect ionStrings[0].ConnectionStri ng))
{
cn.Open();

}

}
catch (Exception ex)
{
Response.Write( ex.Message);
}
Jul 25 '06 #2
First, you need to determine whether "." (the local machine) is indeed valid
for that SQL Server instance. For example, it may actually be something like
".\SQLNAME" .
Also, ensure the userid and password are correct, and that both Windows and
SQL Server authentication are enabled on the SQL Server.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"thom" wrote:
>
Using Vs2005 sqlServer 2005

When i try to connect i get this 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)

Connection string:
<connectionStri ngs>
<add name="pubsConne ctionString1" connectionStrin g="Data Source=.;Initia l
Catalog=pubs;Us er=mk;pw=x"
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>

Calling code :

try
{
using (SqlConnection cn = new
SqlConnection(W ebConfiguration Manager.Connect ionStrings[0].ConnectionStri ng))
{
cn.Open();

}

}
catch (Exception ex)
{
Response.Write( ex.Message);
}
Jul 25 '06 #3
I just created a new site, i added a strongly typed ds to the app_data, the
connection string that was pub in my webconfig is:

<connectionStri ngs>
<add name="Northwind ConnectionStrin g" connectionStrin g="Data
Source=.;Initia l Catalog=Northwi nd;Integrated Security=True"
providerName="S ystem.Data.SqlC lient"/>
</connectionStrin gs>

and this works

so i created this code,,, and it works, thanks

using System;
using System.Data;
using System.Configur ation;
using System.Collecti ons;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;
using System.Data.Sql Client;

public partial class ErrPage : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
try
{
string s = "Data Source=.;Initia l Catalog=Northwi nd;Integrated
Security=True";
SqlConnection cn = new SqlConnection(s );
cn.Open();
Response.Write( cn.State);
}
catch (Exception ex)
{
Response.Write( ex.Message);
}

}
}
"Peter Bromberg [C# MVP]" wrote:
First, you need to determine whether "." (the local machine) is indeed valid
for that SQL Server instance. For example, it may actually be something like
".\SQLNAME" .
Also, ensure the userid and password are correct, and that both Windows and
SQL Server authentication are enabled on the SQL Server.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"thom" wrote:

Using Vs2005 sqlServer 2005

When i try to connect i get this 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)

Connection string:
<connectionStri ngs>
<add name="pubsConne ctionString1" connectionStrin g="Data Source=.;Initia l
Catalog=pubs;Us er=mk;pw=x"
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>

Calling code :

try
{
using (SqlConnection cn = new
SqlConnection(W ebConfiguration Manager.Connect ionStrings[0].ConnectionStri ng))
{
cn.Open();

}

}
catch (Exception ex)
{
Response.Write( ex.Message);
}
Jul 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2184
by: deltalimagolf | last post by:
I now get the following error message after copying an asp.net application to the deployment web server. I don't have SQLExpress or any version of SQL 2005 installed. I found the "LocalSQLServer" connection string in the machine.config, changed that to look at a SQL 2000 database, but the error still comes up. An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be...
1
4723
by: John Shadel | last post by:
I have the following setup: 1. ASP.NET 2.0 web app hosted on a web server (inetpub directory hosting physical files of the web site on a different drive name, E: than the SQL Server Instance, which is on C:) 2. SQL Server on the same server, with security settings enabling ASPNET group and groups containing users allowed to interact with the website added to SQL Server Instance security settings. 3. Impersonation = true, i.e. ASPNET...
0
1442
by: Tor Inge Rislaa | last post by:
Just for testing deployment of an asp.net application to the remote server I have crated an application based on the StarterKit application in Visual Studio 2005. When trying to run the application from my browser I get the error message below.
5
1930
by: James | last post by:
Hello, I have written a simple logon page that redirects to another page when successful. All works fine on my computer but when I upload it I get the error message below. I have written it in ASP.net v2, and have put it on IIS v6 on windows server 2003. I think it may be something to do with connection string to the database,
1
7042
by: NEWS | last post by:
My application is giving error .pls help . error : Server Error in '/webpdms' Application. -------------------------------------------------------------------------------- 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: Named Pipes Provider, error: 40...
0
1996
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ((string)(this.GetPropertyValue("Address1")));
5
3542
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting this error. Any idea why? Server Error in '/myuser4/MyWebApp' Application. --------------------------------------------------------------------------------
13
3322
by: AAaron123 | last post by:
I downloaded the personal website starter kit and when I run it I get the error shown below. I found a way of using Launch Surface Area Configuration that is supposed to fix the remote setting but I tried it and still get the error. I do not have SQL Server 2005 installed (thought I did once). I do have SQL Server 2008 installed. I don't see anywhere in the code where SQL Server 2005 is referenced.
0
8192
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8358
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1504
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.