Alan2
Alan2

Reputation: 24602

How can I log my SQL calls in Visual Studio 2013?

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?

Upvotes: 7

Views: 427

Answers (3)

InbetweenWeekends
InbetweenWeekends

Reputation: 1414

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

Upvotes: 1

tomsv
tomsv

Reputation: 7277

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

Upvotes: 6

Martin Shishkov
Martin Shishkov

Reputation: 2837

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

Upvotes: 0

Related Questions