/ Assembly List / LJCDBMessage / DbConditionSet

Namespace - LJCDBMessage


Syntax

C#
public class DbConditionSet

Represents the conditions and properties. (E)

Constructor
#ctor Initializes an object instance.
#ctor The Copy constructor.

Data
Clone Creates and returns a clone of the object.
3 Methods

Properties
BooleanOperator The conditions boolean operator.
Conditions Gets or sets the conditions.

Example

C#
using LJCDBMessage;
        
// Initialize a Filter object.
DbFilter dbFilter = new DbFilter();
        
// The BooleanOperator seperatates each Condition statement.
// The BooleanOperator can be "and" or "or". If not specified, it
// defaults to "and".
DbConditionSet conditionSet = dbFilter.ConditionSet;
conditionSet.BooleanOperator = "and";
        
// Note that a condition without a specified ComparisonOperator defaults
// to the equals "=" comparison operator.
DbConditions conditions = conditionSet.Conditions;
conditions.Add("Street", "'First Street'", "=");
conditions.Add("City", "'Lake Mary'");
conditions.Add("PostalCode", "'32746'");
        
// These conditions result in this Where clause.
// where ((Street = 'First Street' and City = 'Lake Mary'
//   and PostalCode = '32746'))
        
DbFilter secondFilter = new DbFilter
{
  BooleanOperator = "or"
};
DbConditions secondConditions = secondFilter.ConditionSet.Conditions;
secondConditions.Add("Street", "'Somewhere%'", "like");
dbFilters.Add(secondFilter);
        
// where ((Street = 'First Street' and City = 'Lake Mary'
//    and PostalCode = '32746'))
//  or ((Street like 'Somewhere%'))

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.