Click or drag to resize

DatabaseDBLookup Method (String, String, String, DataFuncOptions, String, String)

You can use the DBLookup function to get the value of a particular column from a specified set of records (a domain).

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public Object DBLookup(
	string column,
	string table,
	string where,
	DataFuncOptions options,
	string orderBy,
	string logSource
)

Parameters

column
Type: SystemString
An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be an expression that performs a calculation on data in that field.
table
Type: SystemString
A string expression identifying the set of records that constitutes the domain. It can be a table name or a view name.
where
Type: SystemString
An optional string expression used to restrict the range of data on which the DLookup function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the DLookup function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain.
options
Type: NetQuarryDataFuncOptions
A bitmask of DataFuncOptions enumeration flags.
orderBy
Type: SystemString
An optional sort clause to include in the query.
logSource
Type: SystemString
The source of the operation, to be logged to the devlog.

Return Value

Type: Object
The value in the column or null if no records are returned.

Implements

IDatabaseDBLookup(String, String, String, DataFuncOptions, String, String)
Remarks
Note that for performance reasons, this function does NOT check if multiple rows are returned from the query.
Examples
C#
// Lookup the first customer with a CompanyName that starts with Alfreds and print the value
object    val = db.DBLookup("CompanyName", "Customers", "CompanyName LIKE 'Alfreds%'");        
Console.WriteLine(val.ToString());

// Write the number of customers
Console.WriteLine(db.DBCount("*", "Customers", ""));
See Also