1
votes

I have connection string, but it isn't working. Why?

Error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Connection string:

<add name="CompanyEventConnectionString" 
     connectionString="database=db;server=PETLITSKY-R\SQLEXP;user id=sas; password=P@ssword1; MultipleActiveResultSets=True;" />
2
I'm not sure we can tell just from the string. Can you connect to this database manually through some local SQL Client? - James Wiseman
Did you really install SQL Server Express and explicitly choose to call your instance SQLEXP?? If you have Express but a default installation - use PETLITSKY-R\SQLEXPRESS as the server name - marc_s

2 Answers

0
votes

In the SQL Server Configuration Manager->SQL Server Network Configuration->Protocols, check that named pipes and tcp/ip are enabled.

If that doesn't work then it may be your firewall blocking it, try this link: http://msdn.microsoft.com/en-us/library/cc646023.aspx

This may be useful too: http://support.microsoft.com/kb/287932

0
votes
<add name="ConString" connectionString="Data Source=.;InitialCatalog=ServerMaintenance;User Id=sa;Password=something;" />