7

I used to have it working great. I would just select the output window and all the calls would be logged and output. But then I reinstalled VS 2013 and now I see nothing.

Please note this is a built in feature. Not something I used to do with debug calls or anything in my code.

I have been doing this for over a year now and just cannot figure out what option I selected to make it happen. Can anyone remember how to do this?

Kit
  • 20,354
  • 4
  • 60
  • 103
Alan2
  • 23,493
  • 79
  • 256
  • 450
  • @Samantha/Alan - Are these SQL calls sent through Entity Framework or all SQL calls regardless of how they were sent? – Martin Smith Jul 12 '15 at 14:51

3 Answers3

6

Starting with EF 6.0 you would do

using (var context = new BlogContext()) 
{ 
    context.Database.Log = Console.Write; 
    // Other code here... 
}

From here: Logging and Intercepting Database Operations

tomsv
  • 7,207
  • 6
  • 55
  • 88
1

For VS2013 Pro, I can't get the query to the output window, but you can make it log to the Message pane of the query results. Is this what you're referring to?

Tools >
   Options > 
       SQL Server Tools > 
           Transact-SQL-Editor > 
               Query Results > 
                   Results to Grid

Check 'Include the query in the result set'enter image description here enter image description here

InbetweenWeekends
  • 1,405
  • 3
  • 23
  • 28
0

Are you talking about IntelliTrace? However it is only available in VS Ultimate editions. See Intellitrace not available for VS 2012 Professional edition?

Community
  • 1
  • 1
Martin Shishkov
  • 2,709
  • 5
  • 27
  • 44
  • No, I'm talking about the SQL calls that I for sooo long made appear in the output window. I am using VS2013 Ultimate btw – Alan2 Apr 11 '15 at 14:15
  • 2
    Usually the output in the Output Window is printed with Debug.Write or Debug.WriteLine. Make sure you are running the project in Debug mode. – Martin Shishkov Apr 11 '15 at 14:23
  • There's a way to have this done for you. Just cannot remember what option I used. Never needed to do any Debug.Write or anything like that. – Alan2 Apr 13 '15 at 03:26