user7280961
user7280961

Reputation:

SQL Server connection string ASP.net

Here is my connection string to a remote SQL Server :

<connectionStrings>
    <add name="WebSiteDB"
         connectionString="Server=.MSSQLSERVER2012;Database=mydb;User Id=myid;Password=mypw;"   
         providerName="System.Data.SqlClient" />
</connectionStrings>

When I open my connection it throws an exception :

Named Pipes Provider, error: 40

Can someone help me?

Upvotes: 1

Views: 365

Answers (2)

Saman Hajizade
Saman Hajizade

Reputation: 270

I corrected an error like this by restarting sql server services. Restart MSSQLSERVER service in data server services.

Sql network interface error :26 is for wrong server name or instance name. mostly instance name

Upvotes: 0

DeanOC
DeanOC

Reputation: 7282

The format of the Server attribute is Server=myServerName\myInstanceName. So I think that you need a backslash after the dot, i.e. Server=.\MSSQLSERVER2012

If that doesn't work, then here are two websites that give you connection string formats https://msdn.microsoft.com/en-us/library/jj653752(v=vs.110).aspx

https://www.connectionstrings.com/sql-server-2012/

Upvotes: 1

Related Questions