user154366
user154366

Reputation: 581

Sql Connection String to named instance

I can connect to my sql server 2008 developer server using this in a sample code project:

string connection = @"data source=.\SQLSERVER2008;Integrated Security=SSPI;Initial Catalog=RSINET.MVC";

When I try updating the web.config file like so, I get a sql exception:

 <add name="ApplicationServices" connectionString="data source=.\SQLSERVER2008;Integrated Security=SSPI;Initial Catalog=RSINET.MVC" providerName="System.Data.SqlClient"/>

The error that I get is this:

Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

I am using the .NET provider?

matt

Upvotes: 2

Views: 12005

Answers (3)

CervEd
CervEd

Reputation: 4233

Add the port (default 1433) to the connection string.

Ie: localhost\SQLSERVER2008,1433

Upvotes: 0

Aaron Bertrand
Aaron Bertrand

Reputation: 280252

Did you try using LOCALHOST\SQLSERVER2008 or 127.0.0.1\SQLSERVER2008 or \SQLSERVER2008? Also why is there a period in your database name? You will likely have to escape that (or preferably get rid of it by changing the name)... even if it doesn't solve this issue, it will cause others if you leave it that way.

Upvotes: 1

Raj More
Raj More

Reputation: 48018

Configure your server for remote connections

http://support.microsoft.com/kb/914277

Upvotes: 0

Related Questions