Returns a collection of objects that match the specified search criteria. This function utilises any subsets, ordering or table joins specified in this collection. To add a set of conditions to the objSearchCriteria object with higher precendance use the "Add(SQLConditions)" overloaded as this will wrap the conditions within parentheses.

Namespace: DatabaseObjects.Generic
Assembly: DatabaseObjects (in DatabaseObjects.dll) Version: 3.8.1.0

Syntax

C#
protected IList<T> ObjectsSearch(
	SQLConditions objSearchCriteria
)
Visual Basic
Protected Function ObjectsSearch ( _
	objSearchCriteria As SQLConditions _
) As IList(Of T)
Visual C++
protected:
IList<T>^ ObjectsSearch(
	SQLConditions^ objSearchCriteria
)

Parameters

objSearchCriteria
Type: DatabaseObjects.SQL..::..SQLConditions
The criteria to search for within this collection. To add set a of conditions with with higher precendance use the "Add(SQLConditions)" overloaded function as this will wrap the conditions within parentheses.

Return Value

IList (System.Collections.IList)

Remarks

The following wildcard characters are used when using the LIKE operator (extract from Microsoft Transact-SQL Reference):
Wildcard characterDescriptionExample
%Any string of zero or more characters.WHERE title LIKE '%computer%' finds all book titles with the word 'computer' anywhere in the book title.
_ (underscore)Any single character.WHERE au_fname LIKE '_ean' finds all four-letter first names that end with ean (Dean, Sean, and so on).

Examples

CopyC#
Public Function Search(ByVal objSearchCriteria As Object, ByVal eType As SearchType) As IList

    Dim objConditions As SQL.SQLConditions = New SQL.SQLConditions

    Select Case eType
        Case SearchType.DescriptionPrefix
            objConditions.Add("ProductName", SQL.ComparisonOperator.Like, objSearchCriteria & "%")
        Case SearchType.Description
            objConditions.Add("ProductName", SQL.ComparisonOperator.Like, "%" & objSearchCriteria & "%")
    End Select

    Return MyBase.ObjectsSearch(objConditions)

End Function

See Also