Returns an object using a unique key value.
The key must be unique within this collection. If the collection's DatabaseObjects.Subset
has been implemented then the key need only be unique within the subset specified, not the
entire database table.
Returns Nothing/null if the object does exist with the specified key.
This feature is what differentiates DatabaseObjects.ObjectByKey() from DatabaseObjects.ObjectByKeyExists().
Namespace: DatabaseObjects.GenericAssembly: DatabaseObjects (in DatabaseObjects.dll) Version: 3.8.1.0
Syntax
C# |
---|
protected T ObjectByKeyIfExists( Object objKey ) |
Visual Basic |
---|
Protected Function ObjectByKeyIfExists ( _ objKey As Object _ ) As T |
Visual C++ |
---|
protected: T ObjectByKeyIfExists( Object^ objKey ) |
Parameters
- objKey
- Type: System..::..Object
The key that identifies the object with this collection. The key is the value of the field defined by this collection's KeyFieldName.
Return Value
[Missing <returns> documentation for "M:DatabaseObjects.Generic.DatabaseObjects`1.ObjectByKeyIfExists(System.Object)"]
Examples
CopyC#
Default Public ReadOnly Property Item(ByVal strProductCode As String) As Product Get Return MyBase.ObjectByKey(strProductCode) End Get End Property