Connect LINQPad to remote SQL Server

trailmax picture trailmax · Aug 10, 2011 · Viewed 13.9k times · Source

Disclaimer: I understand the question is very basic, but I could not find the answer in Google or here, and can not do it myself with guessed configuration.

I want to get started with LINQPad and I have a SQL Server 2005 installed on different machine in the same domain. But I can not connect to that server from LINQPad.

Here is the screenshot: Fail to connect

What do I put as a Server string?

Many thanks in advance!

Update 1: SERVERNAME\MSSQLSERVER does make a difference. Instead of Error

26 (Can not find server instance)

I get error

25 (Connection string is not correct)

I have tried 2 different SQL Servers: SQL 2005 on production server and Sql Server 2008 R2 on local machine, I have tried windows authentication and SQL authentication. And it makes no difference. But I can connect to both server (2005 and 2008) with MS SQL Server Management Studio with Windows and SQL server authentication. And it's not SQL Server permission issue - I have tried SA user to connect. It works with , but not with LINQPad.

Any advice? Is there a setting on SQL Server I need to change?

Update 2: I found the solution to the problem. Into Server field I had to put SERVERNAME\ without specifying SQLEXPRESS or MSSQLSERVER.
Not very intuitive =(

Answer

trailmax picture trailmax · Aug 10, 2011

I found the solution to the problem. Into Server field I had to put "SERVERNAME\" without any SQLEXPRESS or MSSQLSERVER. Also as pointed out by @sgmoore, I could just type "LOCALHOST" or "SERVERNAME" and it connected. Apparently this is SQL Server feature/bug, nothing to do with LINQPad.

UPD You can also use "." to denote "localhost" enter image description here