Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic Code: Visual C++

C#
Visual Basic
Visual C++

Berkeley DB .NET API Documentation
BaseDatabase..::.Exists Method (DatabaseEntry, Transaction)
BaseDatabase Class See Also Send Feedback

Check whether key appears in the database.

Namespace: BerkeleyDB
Assembly: libdb_dotnet53 (in libdb_dotnet53.dll) Version: 5.3.28.0

# Syntax

C#
    public bool Exists(
    	DatabaseEntry key,
    	Transaction txn
    )

Visual Basic (Declaration)
    Public Function Exists ( _
    	key As DatabaseEntry, _
    	txn As Transaction _
    ) As Boolean

Visual C++
    public:
    bool Exists(
    	DatabaseEntry^ key,
    	Transaction^ txn
    )

#### Parameters

key
  Type: BerkeleyDB..::.DatabaseEntry
  The key to search for.

txn
  Type: BerkeleyDB..::.Transaction
  If the operation is part of an application-specified transaction, txn is a Transaction object returned from BeginTransaction()()(); if the operation is part of a Berkeley DB Concurrent Data Store group, txn is a handle returned from BeginCDSGroup()()(); otherwise null.

#### Return Value

True if key appears in the database, false otherwise.

# Remarks

If txn is null and the operation occurs in a transactional database, the operation will be implicitly transaction protected.

# Exceptions

Exception | Condition
--- | ---
BerkeleyDB..::.NotFoundException | A NotFoundException is thrown if key is not in the database.
BerkeleyDB..::.KeyEmptyException | A KeyEmptyException is thrown if the database is a QueueDatabase or RecnoDatabase database and key exists, but was never explicitly created by the application or was later deleted.

# See Also

BaseDatabase Class
Exists Overload
BerkeleyDB Namespace