Returns an instance of an object from this collection using a distinct value as specified by DistinctFieldName. If Subset has been implemented then the objDistinctValue need only be unique within the subset specified, not the entire database table. Returns Nothing/null if the distinct value does not exist in the database. This feature is what differentiates DatabaseObjects.Object() from DatabaseObjects.ObjectIfExists().

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

Syntax

C#
protected T ObjectIfExists(
	Object objDistinctValue
)
Visual Basic
Protected Function ObjectIfExists ( _
	objDistinctValue As Object _
) As T
Visual C++
protected:
T ObjectIfExists(
	Object^ objDistinctValue
)

Parameters

objDistinctValue
Type: System..::..Object
The value that uniquely identifies the object within this collection. This is the value of the field defined by this collection's DistinctFieldName function.

Return Value

[Missing <returns> documentation for "M:DatabaseObjects.Generic.DatabaseObjects`1.ObjectIfExists(System.Object)"]

Examples

Loads a product using a product ID of 123
CopyC#
Dim objProduct As Product = MyBase.Object(123)

See Also