Page 1 of 1

LINQ - MySQL - Is it possible to debug?

Posted: Mon 31 Aug 2009 13:40
by Blue56
I am using MySQL and would like to see the sql statements that is send to the database-server. Can I do that?

I can do it with LINQ to SQL. Described here:
http://weblogs.asp.net/scottgu/archive/ ... lizer.aspx

Posted: Tue 01 Sep 2009 10:09
by Zero-G.
Hey

There are two ways to see the LinQ2SQL Statement, which is sent to the server.

1) You can use the log of the DataContext you have created

Code: Select all

DataContext.Log = Console.Out
2) You can use the MySQL Monitor (I think it is a free tool here)

Code: Select all

Dim myMonitor As New Devart.MySQL.MysqlMonitor
myMonitor.Active = True

Dim mySQL = Query From myDataContext.Customers

For Each row in mySQL

Next
When you open the MySQL Monitor, you can see all the Statements as well.

I hope the code was written correct. I did it out of my mind...