[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Sql Server 2005 Connection Error

Posted on 2007-11-26
3
Medium Priority
?
168 Views
Last Modified: 2010-03-19
I am using the following connection string
"Data Source=(local);Initial Catalog=PAINT_DBS;Integrated Security=true"

Getting the Below Error. Not sure how to fix this.  I am using Sql Server 2005 Express.  My windows application would be installed on several machines which will have their own local database. So I am using the above connection string. GEtting 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)"}
0
Comment
Question by:AdibRahman77
[X]
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
  • 2
3 Comments
 
LVL 17

Expert Comment

by:Chris Mangus
ID: 20351412
Instead of coding your Data Source as (local) try servername\sqlexpress
0
 

Author Comment

by:AdibRahman77
ID: 20351535
I want this value to be dynamic. My application would be installed on several  machines.  I would not know the servername and sql server name in advance.
So I tried to use local to make it independent of the actual name. But this gives the above error.

0
 
LVL 17

Accepted Solution

by:
Chris Mangus earned 1500 total points
ID: 20351616
You can retrieve the server name from the environment variable via VBA.ENVIRON$("COMPUTERNAME").  If you install SQL Express with all default options then the instance name is always SQLExpress.

Alternatively, you would need to use SQL Server Configuration Manager to set an alias to the local machine.
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

656 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