'Declaration Public Class SqlMonitor Inherits Devart.Common.DbMonitorHelper Implements System.ComponentModel.IComponent, System.IDisposable
public class SqlMonitor : Devart.Common.DbMonitorHelper, System.ComponentModel.IComponent, System.IDisposable
'Declaration Public Class SqlMonitor Inherits Devart.Common.DbMonitorHelper Implements System.ComponentModel.IComponent, System.IDisposable
public class SqlMonitor : Devart.Common.DbMonitorHelper, System.ComponentModel.IComponent, System.IDisposable
To enable monitoring just drop SqlMonitor 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 SqlMonitor 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 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.
// Console application [MTAThread] static void Main(string[] args) { SqlMonitor myMonitor = new SqlMonitor(); myMonitor.IsActive = true; ... } // Web application void Page_Load(object sender, EventArgs e) { if (Application["mon"] == null) Application.Add("mon", new Devart.Data.SqlServer.SqlMonitor() {IsActive = true}); }
' Console application <MTAThread()> _ Sub Main() Dim myMonitor As SqlMonitor = New SqlMonitor 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.SqlServer.SqlMonitor() With {.IsActive = True}) End If End Sub
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Devart.Common.DbMonitor
Devart.Data.SqlServer.SqlMonitor
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2