what instance name in connection string for Dynamic management Views

1

I want to run the following query ::

SELECT S.*
  FROM sys.dm_exec_requests S
  JOIN sys.dm_exec_sessions R ON r.session_id = s.blocking_session_id

It works when i run it in SQL Server Console.
But I haven't been able to do the same thru code. I am using the following connection string:

"Data Source=localhost\\sqlexpress;Initial Catalog=Master;Integrated Security = True"

Till now I have used sys and MsSQLSystemResource in the place of Master in the connection string ; But i am facing same error which says that there is problem connecting .. instance name could be wrong ..

i keep getting the following error

System.Data.SqlClient.SqlException (0x80131904): 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)
sql-server-2008
networking
remote-access
asked on Server Fault Jun 2, 2011 by Chani • edited Jun 2, 2011 by Chani

1 Answer

0
Data Source=(local)\sqlexpress

I assume the double \ was for escaping

answered on Server Fault Jun 2, 2011 by gbn

User contributions licensed under CC BY-SA 3.0