combit List & Label 29 - .NET Help
combit.Reporting.DataProviders Namespace / DbCommandSetDataProvider Class / ExecuteDbCommand Event

In This Topic
    ExecuteDbCommand Event (DbCommandSetDataProvider)
    In This Topic
    This event allows to edit the DbCommand before it is executed on the database.
    Public Event ExecuteDbCommand As EventHandler(Of ExecuteDbCommandEventArgs)
    public event EventHandler<ExecuteDbCommandEventArgs> ExecuteDbCommand
    event EventHandler<ExecuteDbCommandEventArgs^>^ ExecuteDbCommand
    Event Data

    The event handler receives an argument of type ExecuteDbCommandEventArgs containing data related to this event. The following ExecuteDbCommandEventArgs properties provide information specific to this event.


    The IDbCommand instance which is to be executed on the database. You can e.g. edit the SQL statement or change the parameter values.


    A record limit that might be set (e.g. 1 when opening the Designer, 5 when drawing a crosstab preview etc.). If you modify the query, you could use this to optimize performance.


    The table name for the command in the Designer.

    void MyCommandDataSetProvider_ExecuteDbCommand(object sender, ExecuteDbCommandEventArgs e)
      e.Command.CommandText = e.Command.CommandText.Replace("*", "[Address], [CustomerName], [City]");
    Private Sub MyCommandDataSetProvider_ExecuteDbCommand(sender As Object, e As ExecuteDbCommandEventArgs)
    	e.Command.CommandText = e.Command.CommandText.Replace("*", "[Address], [CustomerName], [City]")
    End Sub

    Platforms: Windows 10 (Version 21H2 - 23H2), Windows 11 (21H2 - 22H2), Windows Server 2016 - 2022
    .NET: .NET Framework 4.8, .NET 6, .NET 7, .NET 8

    See Also