dotConnect for MySQL Documentation
MySqlMonitor Class
Members  Example  See Also  Send comments on this topic.
Devart.Data.MySql Namespace : MySqlMonitor Class

Monitors dynamic SQL execution in applications that use dotConnect for MySQL.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         Devart.Common.DbMonitor
            Devart.Common.DbMonitorHelper
               Devart.Data.MySql.MySqlMonitor

Syntax

Visual Basic (Declaration) 
Public Class MySqlMonitor 
   Inherits Devart.Common.DbMonitorHelper
   Implements IComponentIDisposable 
C# 
public class MySqlMonitor : Devart.Common.DbMonitorHelper, IComponentIDisposable  

Remarks

To enable monitoring just drop Devart.Data.MySql.MySqlMonitor component to the form and set IsActive property to true. If dbMonitor application has already been started you can see messages and SQL statements that your application executes. For monitoring you need only one Devart.Data.MySql.MySqlMonitor component on any of the forms your application consists of.

For example on how to trap SQL events in your application please refer to description of Devart.Common.DbMonitor.TraceEvent event of Devart.Common.DbMonitor.

For monitoring multithreaded applications with dbMonitor tool you have to specify ApartmentState.MTA attribute as shown in the example below.

See also Using dbMonitor topic.

Example

This sample shows how to enable SQL monitoring in console and web applications. To activate monitoring for web applications, a Devart.Data.MySql.MySqlMonitor object may be added to the Application collection at the first load of the default page.
C#csharpCopy Code
// Console application
[MTAThread]
static void Main(string[] args)
{
        MySqlMonitor myMonitor = new MySqlMonitor();
        myMonitor.IsActive = true;
        ...
}

// Web application
void Page_Load(object sender, EventArgs e)
{
        if (Application["mon"] == null)
        Application.Add("mon", new Devart.Data.MySql.MySqlMonitor() {IsActive = true});
}
C#Visual BasicCopy Code
' Console application
<MTAThread()> _
Sub Main()
        Dim myMonitor As MySqlMonitor = New MySqlMonitor
        myMonitor.IsActive = True
        ...
End Sub

// Web application
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Application("mon") Is Nothing Then
                Application.Add("mon", New Devart.Data.MySql.MySqlMonitor() With {.IsActive = True})
    End If
End Sub

Requirements

Namespace: Devart.Data.MySql

Platforms:Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8, Windows 10, Windows Server 2012 family.

See Also