?
Solved

Sql Server 2005 Connection Error

Posted on 2007-11-26
3
Medium Priority
?
166 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

764 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