How would one go about seeing the SQL generated by a LINQ2SQL insert? Let's say that I have


is there anyway to see the SQL? I've installed the LINQtoSQL visualizer Scott Gu mentions ( and it does seem to work for full LINQ queries but not for inserts such as this.

Was it helpful?


You can use DataContext.Log to log the SQL. You can set any TextWriter to the DataContext.Log property. If you want to log output to your debugger or console, try this - and you're good to go.


The SQL Server Profiler will show you the generated queries. It will also show you the execution plans that the SQL Server uses to solve those queries, and provide you with ways to improve performance.

More info at

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top