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 ..
Creating a view in a database you created (rather than system ones), setting the connection string to that database, then query the view.