Hi,
I have been getting this error for about 6 hours now. I have read every article from google about it and absolutely none of the solutions work for me.
I am running Windows XP Home Edition
I downloaded and installed Visual Studio Web Developer Express about a week ago.
I downloaded SQL Server Express 2005 yesterday.
It installed fine.
I got my first error trying to add New Item->Sql Server Database only to find out the default instance SQLExpress was not working and i was running a different instance.
Anyway, I am trying to connect to sql server with the below code:
SqlConnection myConnection =new SqlConnection("server=mycomp/mssqlserver;database=mydb;Trusted_Connection=yes"); SqlCommand myCommand =new SqlCommand("select category, title, article from articles where id=15");// + article + ");", myConnection); myConnection.Open();
Which give me the 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
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.SqlClient.SqlException: 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 - Could not open a connection to SQL Server)
Source Error:
Line 30: SqlCommand myCommand = new SqlCommand("select category, title, article from articles where id=15");// + article + ");", myConnection);Line 31:Line 32: myConnection.Open();Line 33: Line 34:
I have followed all the instructions online like enabling 445 firewall stuff, making sure i accept local and remote connection, enabling TCP/IP Named pipes and heaps of protocols ect but nothing works.
I am about to uninstall sql server and .net and call it quits.
This stupid server is too hard to configure.
If anyone could help me get it running it would be gretly appreciated however, this question seems to be asked all over the net and i have read gazzilions of threads with all kinds of answers but nothing works.
Thanks
Did you try to re-install SQL? and install it as default instance?
|||Ok, I got your problem. You have to do some more configuration
Go to SQL Server - SQL Server Configuration Manager.
Check the protocols Named Pipes and TCP/IP should be enabled
then go to Client Protocols, and check Named Pipes and TCP/IP should be enabled
Please check it, I hope it works.
Let me know in case of any difficulties.
|||
Thanks guys.
As you can see in my first post i have tried all the common solutions like configuring the client protocols ect.
I think i will just reinstall and see how it goes.
Cheers
|||Let us know how it turns out
No comments:
Post a Comment