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

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

Syntax

C#
public IList ObjectsSearch(
	IDatabaseObjects objCollection,
	SQLConditions objSearchCriteria
)
Visual Basic
Public Function ObjectsSearch ( _
	objCollection As IDatabaseObjects, _
	objSearchCriteria As SQLConditions _
) As IList
Visual C++
public:
IList^ ObjectsSearch(
	IDatabaseObjects^ objCollection, 
	SQLConditions^ objSearchCriteria
)

Parameters

objCollection
Type: DatabaseObjects..::..IDatabaseObjects
The collection to search within.
objSearchCriteria
Type: DatabaseObjects.SQL..::..SQLConditions
The criteria to search for within the collection. To add a set 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 objDatabase.ObjectsSearch(objGlobalProductsInstance, objConditions)

End Function

See Also