Tracing the SQL

Posts   
 
    
pls2917
User
Posts: 11
Joined: 26-May-2009
# Posted on: 02-Jun-2009 19:25:55   

I feel stupid for asking, but after reading pages and pages of the troubleshooting section, I still don't know how to do one simple thing:

Turn on tracing of the generated SQL for my Linq to LLBLGen statements.

Can anyone help me out?

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 02-Jun-2009 21:36:10   

You need to add the

<system.diagnostics>
    <switches>
               <add name="SqlServerDQE" value="3" />
        <add name="LinqExpressionHandler" value="3" />
    </switches>
</system.diagnostics>

section to your app.config - change the values to a 4 to get a LOT of trace output. If you are using any other SQL server change the SqlServerDQE to the relevant value

SQL tracing is often best done using SQL Profiler(or your db's equivalent) - it shows you the actual SQL that is being sent to the server, and keeps it seperate from the other trace outputs, and also allows you to filter etc.

Matt