Thursday, February 16, 2012

Cannot connect to sql database

I'm using Visual Web Developer and SQL 2005...

It Guives me 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)

I'm tired of guetin and search solution for this error

I've tried everything that i searched over the "net"...made all the configurations possible in sql server 2005 and nothing...

Is this right? Or do i need to put some more code in this line or in server is it "localhost:****\...:
...
connection = New SqlConnection("Server=servername\WebSite1\uid=sa;pwd=1234;database=cdcollection")
connection.Open()...
...

Don't know why in sql server i have two object explorer connections when i start the sql server...one is "servername"...two is "servername\sqlexpress" (but when trying to connect with "servername\sqlexpress" it won't let me, only with "servername")...i use the windows authentication...

...when i had the VB.NET 2003 and SQL Server 2000, it was much easy to do this...

In ASP.NET config i still have the C:\inetpub\wwwroot path but the files don't go there...now they go to \my documents\Visual studio 2005 by default of Visual Web Developer prog. Do i need to change the location?


Please help...i'm really desperate...with this...

Hi theminstrel,

In your object explorer you have two (2) SQL instances (server and express).

You would to change authentication mode to SQL Express from Windows only (default) to Sql Server and Windows.

Good Coding!

Javier Luna
http://guydotnetxmlwebservices.blogspot.com/

|||

theminstrel:

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 = New SqlConnection("Server=servername\WebSite1\uid=sa;pwd=1234;database=cdcollection")
connection.Open()...

First make sure you have enabled remote connections for both TCP/IP and NamedPipes in SQL Server Surface Area Configuration. Your connection string is not well formed, it should looks like:

Server=servername;uid=sa;pwd=1234;database=cdcollection

If you're trying to connect to SQL Express, it should be something like:

Server=servername\SQLEXPRESS;uid=sa;pwd=1234;database=cdcollection

www.connectionstrings.com is a good place to find the connection string you want.

theminstrel:

In ASP.NET config i still have the C:\inetpub\wwwroot path but the files don't go there...now they go to \my documents\Visual studio 2005 by default of Visual Web Developer prog. Do i need to change the location?

You can change the location for your website when creating the new website. Then next time you create a website, the default location will be under the the parent folder of the location you specified for the previous website. If you want to create websites deployed under IIS, you can click the Browser button when new a website->switch to Local IIS tab in the Choose Location dialog.

No comments:

Post a Comment