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?
In Visual Studio, make sure that SQL Server Object Explorer is open. If it is not, click the View menu and select SQL Server Object Explorer.
Create or open a SQL file The mssql extension enables mssql commands and T-SQL IntelliSense in the code editor when the language mode is set to SQL. Select File > New File or press Ctrl+N. Visual Studio Code opens a new Plain Text file by default.
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
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With