Debuggin before submitchanges() ?

Debuggin before submitchanges() ?

Postby rodusa » Fri 20 Feb 2009 23:14

How can I debug the generated sql statement before SubmitChanges()?

DbDataContext db = new DbDataContext();
.... // code here

db.SubmitChanges(); // Debug SQL here??????

On SQL Server there is a Visual debug analyzer. Is there anything similar for mysql?

Thank you

Rod
rodusa
 
Posts: 5
Joined: Fri 20 Feb 2009 23:09

Postby Shalex » Mon 23 Feb 2009 15:20

The generated SQL statement cannot be shown before invoking the SubmitChanges() method. But you can see the SQL that was sent to the server after SubmitChanges():
1) either by the help of DBMonitor (refer to our documentation to find out how to use it),
2) or by this code:
StringBuilder sb = new StringBuilder();
databaseContext.Log = new StringWriter(sb);
Shalex
Devart Team
 
Posts: 7344
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for MySQL