Share via


ContentList.Search Method (PIA)

Use this method to create a RowCollection object that allows access to each item in the ContentList object that matches the specified criterion.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Caching
…
Public Function Search(vCol As Object,
 vSearchCriteria As Object) As RowCollection

[C#]

using Microsoft.CommerceServer.Interop.Caching;
…
public RowCollection Search(object vCol,
 object vSearchCriteria);

Parameters

[Visual Basic .NET]

  • vCol
    An Object that identifies the column to search. The column is identified by either a number representing a column position, starting at zero (0), or a string containing a column name.
  • vSearchCriteria
    An Object that contains the filter criterion. The criterion is usually a String, an array of Strings, or an Integer. An attempt will be made to coerce other types to the type of the column being searched.

[C#]

  • vCol
    An object that identifies the column to search. The column is identified by either a number representing a column position, starting at zero (0), or a string containing a column name.
  • vSearchCriteria
    An object that contains the filter criterion. The criterion is usually a string, an array of strings, or an integer. The Search method will attempt to coerce other data types to the type of the column being searched.

Return Values

[Visual Basic .NET] If this method completes successfully, it returns a reference to a new object that implements the RowCollection interface that contains one row for each matching item.

[C#] This method returns an RowCollection interface pointer for a new RowCollection object that allows access to the rows that match the search criteria.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

The following standard COM error value has a particular meaning in the context of this method.

  • S_FALSE
    No rows in the ContentList object matched the filter criteria. As a result, the returned RowCollection is empty.

Remarks

Columns must be shared (not private) and read-only in order to be indexed and searched. Columns must also be of type string, integer (int or short), or object array to be searchable. The search criteria may be any variant type that can be coerced to the type of the column being searched.

When the search criteria is an array of objects, the set of rows returned contains all rows that match any of the search criteria array elements. It is a union of the matches.

This property is functionally identical to the one of the same name in the ContentListFactory object.

[Visual Basic .NET]

Example

'myCol is a RowCollection object
myCol = myContentList.Search(10, "CarAds")

Requirements

Namespace: Microsoft.CommerceServer.Interop.Caching

Platforms: Windows 2000, Windows Server 2003

Assembly: cachecomplib (in cachecomplib.dll)

See Also

ContentList Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.