dotConnect for SQL Server Documentation
Devart.Common Namespace / SelectStatement Class / AddHavingCondition Method
A new condition to add.
Example

In This Topic
    AddHavingCondition Method
    In This Topic
    Adds new condition to HAVING clause of the statement, represented by the Having property.
    Syntax
    'Declaration
     
    Public Sub AddHavingCondition( _
       ByVal condition As String _
    ) 
    public void AddHavingCondition( 
       string condition
    )

    Parameters

    condition
    A new condition to add.
    Remarks
    If the Having property is not empty, the new condition is concatenated using AND keyword.
    Example
    The following example demonstrates how to use the AddHavingCondition method.
    SqlSelectStatement stmt = new SqlSelectStatement();
    stmt.Columns.Add(new SelectColumn("EMP"));
    stmt.Columns.Add(new SelectColumn("SAL"));
    stmt.Tables.Add(new SelectTable("emp"));
    
    stmt.AddHavingCondition("SAL > 1000");
    
    //select JOB,SAL from emp having SAL > 1000
    SqlCommand command = new SqlCommand(stmt.ToString());
    Dim stmt As New SqlSelectStatement
    stmt.Columns.Add(New SelectColumn("EMP"))
    stmt.Columns.Add(New SelectColumn("SAL"))
    stmt.Tables.Add(New SelectTable("emp"))
    stmt.AddHavingCondition("SAL > 1000")
    
    'select JOB,SAL from emp having SAL > 1000
    Dim command As New SqlCommand(stmt.ToString)
    See Also