connecting to sqlserver express

G

Guest

I installed SQLserver express as well as VS2005 Standard. I know the database
server is functioning correctly since I can manipulate it with the sqlserver
express tools. However when I try to connect to the server in VS either
programatically or through the server tools I get the same unfortunate error
message:


{"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)"}

I found a property on the server called Allow Remote Connections to the
Server, which was already checked.

Not really sure where to go from here. Any suggestions?

Thanks,

Bob
 
W

William \(Bill\) Vaughn

Ok, for us to help we need to know a few things:
1) Where is the SQL Server Express edition instance installed? Is it on
the same system hosting the ADO.NET program?
2) How are you trying to connect? Via the Server Explorer or the
Database Explorer?
3) Which version of VS are you using? Express or a higher version?
4) If the connection is remote, have you opened the ports on your
firewall to permit access?
5) What does your connectionstring look like?

That should be enough to get us started.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
C

Cor Ligthert [MVP]

Bob,

I had this error as well. Did you install a beta version before these final
releases.

Have than a look in this directory for Orphaned files

C:\Documents and Settings\YourUserName\Local Settings\Application
Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

I hope this helps,

Cor
 
J

Jochen Schimmel

Hi,

I just wanted to start doing some Studio 2005 / SQL 2005 stuff and
encountered just the same problem as Bob.

My machine is brand new and has got a fresh Windows on it. I had installed
Studio 2003 and afterwards Studio 2005 with SQL 2005. When I tried to access
my local sql 2005 instance by using Server explorer -> "connect to
database" -> "Microsoft SQL Server" I get just the same error as Bob does.

I have then tried to seek for some misconfigured values in SQL Server
Configuration Manager and found that the Protocols don't have names, there
are only the icons, but no text. So I removed SQL 2005 Express from my
machine, downloaded the package from microsoft and installed it without
Studio Setup. Now I can see those strings, but the error won't vanish.
I have then enabled all protocols in Configuration manager and enabled all
stuff in Surface Area Configuration, nothing happened.

My Windows Firewall is turned on, but everything happens locally, the SQL
Express Version is 9.00.1399.06.
I have been browsing to the Docs & settings folder, there wasn't even a SQL
folder. The PC has never seen a beta.

Thanks in advance,

Jochen
 
G

Guest

I have

Winows 2000 sp4.
VS 2005 Standard 8.0.50727.42
SQLServer 2005 Express 9.00.1399.06
SQl Servere Manager Studio Express CTP

Everything is on the same computer.

I've tried using code
sc = new SqlConnection("Data Source=bob;Initial
Catalog=ToDo;Integrated Security=SSPI");
sda = new SqlDataAdapter("select SqlCommandText from
sqlcommand", sc);
ds = new DataSet("SQLCOMMANDTEXT");
sda.Fill(ds, "sqlcommand");

I have also tried through the tools menu -> connect to database.
I choose SQLServer
I select my server name in drop down.
Windows authen
Nothing appears in the DB name list even after a long time searching.
If I type the name in and test I get the error message.

The Server Explorer leads to the same connection form with the same result.

I'm on the same machine so I don't think I would need to open a port. Do I?

I've tried this with my firewall on and off.

Thanks again,

Bob
 
P

Paul Clement

¤ I have
¤
¤ Winows 2000 sp4.
¤ VS 2005 Standard 8.0.50727.42
¤ SQLServer 2005 Express 9.00.1399.06
¤ SQl Servere Manager Studio Express CTP
¤
¤ Everything is on the same computer.
¤
¤ I've tried using code
¤ sc = new SqlConnection("Data Source=bob;Initial
¤ Catalog=ToDo;Integrated Security=SSPI");
¤ sda = new SqlDataAdapter("select SqlCommandText from
¤ sqlcommand", sc);
¤ ds = new DataSet("SQLCOMMANDTEXT");
¤ sda.Fill(ds, "sqlcommand");
¤
¤ I have also tried through the tools menu -> connect to database.
¤ I choose SQLServer
¤ I select my server name in drop down.
¤ Windows authen
¤ Nothing appears in the DB name list even after a long time searching.
¤ If I type the name in and test I get the error message.
¤
¤ The Server Explorer leads to the same connection form with the same result.
¤
¤ I'm on the same machine so I don't think I would need to open a port. Do I?
¤
¤ I've tried this with my firewall on and off.
¤

Try changing the Data Source in your connection string to (local).


Paul
~~~~
Microsoft MVP (Visual Basic)
 
B

bruce_brodinsky

Bob said:
I've tried that one already without success, thanks...

Wondering if it's a permissions or security problem.... I've had
such problems with ASP.Net, Sql Server 2000, etc. I'm just a hobbyist,
usually I have to fiddle with these user/security/permissions issues
till I accidentally get them right... In fact, since it was indicated
that you could get to the database with the management tool, but not
through VS, I would say it's probably a permissions issue. Sorry I
can't help you on the details.
Bruce
 
J

Jochen Schimmel

Hi Bob,

I could solve my issue... it was a total newbie bug in my case... instead of
".\SQLEXPRESS" I entered "SQLEXPRESS" in the server input field... then I
got the same error as you... :)

maybe you've run in the same trap as I did..

greetings,

Jochen
 
G

Guest

I got mine working too. It was all in the name like you said.

Thanks for the fix.

You know its funny I do stuff like this at work all the time without a
problem but as soon as I start messing around with my computer at home I turn
into a newbie.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top