SQL server profiler not showing LINQ To Sql queries

Ronnie Overby picture Ronnie Overby · Apr 8, 2009 · Viewed 9k times · Source

I am trying to view SQL generated by Linq to SQL in the SQL Server Profiler (2005).

I can see the sql sent to the server from anything except for linq to sql.

I'm betting that I need to change event selections for the trace, but not sure what else to select.

I am currently only selecting this: SQL:StmtCompleted - TextData & SPID

I don't want to use data context logging nor the SQL Debug Visualizer. I need to use the profiler.

Why can I not see the LINQ to SQL queries?

Thanks.

EDIT

I added SQL:BatchCompleted and that hasn't helped.

EDIT 2

I added the event RPC:Completed which is found under the Stored Procedures category in event selection. This worked!

Answer

cjk picture cjk · Apr 8, 2009

You need RPC call - the queries are executed as exec_sql.