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)

1 Answer 1

0
Data Source=(local)\sqlexpress

I assume the double \ was for escaping

5
  • yes it was ! shuldnt it be ?
    – Chani
    Jun 2, 2011 at 8:25
  • i didnt understand your answer btw. what are the braces trying to suggest ? is that the syntax ?
    – Chani
    Jun 2, 2011 at 8:27
  • That is the syntax for a local SQL Server install.
    – gbn
    Jun 2, 2011 at 8:28
  • i am going for a remote connection. i have also gone for "Data Source=<machine name>\\sqlexpress;Initial Catalog=Master;Integrated Security = True" but even that dont work
    – Chani
    Jun 2, 2011 at 8:30
  • Can you add the exact error please?
    – gbn
    Jun 2, 2011 at 8:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .