locked
How to view raw query, without SQL Profiler RRS feed

  • Question

  • I'm running an app in a shared hosting environment, and the web host can't give me permission to use SQL Profiler.

    Is there another way in Entity Framework to view the raw SQL of query?

    Or some other way to troubleshoot my queries?

    Here's an example of a query I'm trying to trouble shoot. It returns nothing when it should return results.

    var questions = from q in db.Questions
    	from k in q.Keywords
    	where k.Description == keywordSingle
    			&& k.Description == keywordSingle2
    	orderby q.SortOrder
    	select q;
    


    Monday, August 29, 2011 9:20 PM

Answers

  • OK I found my own answer. In the example above, if you put a Watch on the variable "questions", which gets assigned the query result, it will show the raw SQL used after it passes this line of code.
    • Proposed as answer by Mr. Javaman II Tuesday, August 30, 2011 2:15 AM
    • Marked as answer by Larcolais Gong Monday, September 5, 2011 7:39 AM
    Monday, August 29, 2011 11:46 PM

All replies

  • Good Question...
    JP
    Monday, August 29, 2011 9:33 PM
  • OK I found my own answer. In the example above, if you put a Watch on the variable "questions", which gets assigned the query result, it will show the raw SQL used after it passes this line of code.
    • Proposed as answer by Mr. Javaman II Tuesday, August 30, 2011 2:15 AM
    • Marked as answer by Larcolais Gong Monday, September 5, 2011 7:39 AM
    Monday, August 29, 2011 11:46 PM