1st Timer - VS Studio Can't Connect To SQL Server Express

Posted on 2009-05-08
Last Modified: 2013-11-26
I have just started using Visual Studio and SQL Server - I mean just.  And I can't do the most basic thing, which is more than frustrating.  I've checked the KnowledgeBase and surprisingly did not find a similar question (I suppose I must be really remedial then).

I am trying to add a SQL Server Express db as a data source.  It's errored out with the following messages (I am trying out both VS 6.0 & VS 2008):

In VS 6.0, I get this error:

A network-related or instance-specific error has occurred while establishing a connection to SQL Server.  Server is not found or not accessible.  Check if instance name is correct and if SQL Server is configured to allow remote connections.
Named Pipes Provider: Could not open a connection to SQL Server [2]

In VS 2008, I get a similar error.

I've tried different things, but I got nowhere.  Please help!  It's like it's Christmas, I've got this huge present, but I can't get the wrapping off the package!  :(
Question by:humbleamateur
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
LVL 15

Expert Comment

ID: 24341880
Can you show us the connection string you use to connect in the database?
LVL 20

Expert Comment

ID: 24341921
Aside from the connection string, which is a great place to start, the most common answer to why this is not working is that by default sqlexpress does not have the tcp/ip protocol enabled.

Open SQL Server Configuration Manager.
Open SQL Server 200x Network Configuration branch
On Protocols for SQLEXPRESS make sure TCP/IP is enabled (it is disabled by defalt)

Good Luck,


Author Comment

ID: 24342066
Unfortunately, that didn't fix it.
I'm going to show my ignorance on this one - what exactly are these connection strings I keep reading about?
I was attempting to connect by: Adding a Data Link from the Data Link Window  >  Selecting SQL Server Native Client 10.0 as the OLE Db Provider  >  in Connection tab, selecting the Server, choosing Windows authentication, & then it errors out when I click the dropdown for Database
Thanks again for your help!
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

LVL 20

Accepted Solution

ddayx10 earned 500 total points
ID: 24342463
Connection Strings are data packaged in such a way that your application knows how to find and communicate with your datasource.

Usually the term "Data Link Window" would be a description for the window that displays when you use the "Connect to Database" option in Server Explorer. I'm sure I've seen it somewhere else, but I'm having trouble referencing how exactly you are coming accross it. I am also finding it strange that you are finding the term "SQL Server Native Client 10.0" in this dialogue. Not that its a bad term it just tells me you are looking at something I wasnt expecting.

So many things could be wrong here it's not funny. Try connecting this way, using VS 2008:
1) Open Server Explorer (View>>Server Explorer if you dont see it)
2) Choose "Connect to Database" button.
3) Select Microsoft SQL Server(Sql Client) as the Data source.
4) You said you selected the server before, what did you select?
In the "Server Name" box I didn't have my sqlexpress instance name by default and I have to type in .\sqlexpress OR [COMPUTER DESCRIPTION]\sqlexpress
5) Windows Auth is fine, unless you specifically changed this setting during install of sqlexpress
**If sqlexpress installed with your version of visual studio dont sweat my reference to installing it
6)Choose test connection button and see what gives.
SQL also has to be setup properly for this connection to work. Have you opened your sqlexpress instance using SQL Server Management Studio? If you dont have that tool just do a search for it on the web, its free from the mfg.

As previously mentioned the protocols for sqlexpress need to be enabled for tcp/ip. After you enabled that it should have prompted you to restart the service. If you did not do this it will not connect.

Also by some weird chance if the service isnt running you will not connect.  In SQL Server Configuration Manager, under SQL Server 200x Services make sure SQL Server(SQLEXPRESS) is running (this is where you would restart the service when prompted as well).

If you cant connect still then I wonder if you changed the authentication method during install of sql server express? Otherwise this should work.

Good Luck,


Author Closing Comment

ID: 31579703
That worked!  Thanks so much!!
LVL 27

Expert Comment

by:Chris Luttrell
ID: 24346005
Hi humbleamateur,
What was your actual problem/ final solution? others were wathcing this thread for the solution.

Author Comment

ID: 24346064
I had to enable TCP/IP, because the default for that was disabled like dday said.
It finally worked when I followed dday's advice to type in "[COMPUTER DESCRIPTION]\sqlexpress" for the server.  I had had no idea what was required in that field and just assumed that whatever was in the dropdown list was what was wanted.
Also, when I was following the steps in dday's final post, I received an error - something like "Data log is full."  I did a quick search on EE's Knowledgebase & found a working solution in less than a minute.
So, EE came through in many ways extremely quickly, as always!
LVL 27

Expert Comment

by:Chris Luttrell
ID: 24346074
Thanks for the info. It will help others that search the Knowledgebase like you did.

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question