Page 1 of 1

Resulting sql

Posted: Fri 30 Oct 2009 19:36
by iOgre
Is there any way to get resulting sql query?

(at the moment of DataContext.SubmitChanges() execution, for example)

Posted: Mon 02 Nov 2009 09:16
by Shalex
You can get the queries executed in the context using its Log property:

Code: Select all

DataContext1.DataContext1 ctx = new DataContext1.DataContext1();
StringBuilder sb = new StringBuilder();
ctx.Log = new StringWriter(sb);