dotConnect for Oracle Documentation
Devart.Common Namespace / SelectStatement Class / AddWhereCondition Method
A new condition to add.
Example

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

    Parameters

    condition
    A new condition to add.
    Remarks
    If the Where property is not empty, the new condition is concatenated using AND keyword.
    Example
    The following example demonstrates how to use the AddWhereCondition method.
    OracleSelectStatement stmt = new OracleSelectStatement();
    stmt.Columns.Add(new SelectColumn("ENAME"));
    stmt.Tables.Add(new SelectTable("emp"));
    
    stmt.Where = "1000 < SAL";
    stmt.AddWhereCondition("SAL < 1500");
    stmt.AddWhereCondition("JOB = 'SALESMAN'");
    
    //select ENAME from emp where ((1000 < SAL) AND SAL < 1500 ) AND JOB = 'SALESMAN'
    OracleCommand command = new OracleCommand(stmt.ToString());
    Dim stmt As New OracleSelectStatement
    stmt.Columns.Add(New SelectColumn("ENAME"))
    stmt.Tables.Add(New SelectTable("emp"))
    
    stmt.Where = "1000 < SAL"
    stmt.AddWhereCondition("SAL < 1500")
    stmt.AddWhereCondition("JOB = 'SALESMAN'")
    
    'select ENAME from emp where ((1000 < SAL) AND SAL < 1500 ) AND JOB = 'SALESMAN'
    Dim command As New OracleCommand(stmt.ToString)
    See Also