Select
Last updated
Last updated
To begin working with an entity, start with the name of the entity. Use the select
method to begin a new query. This method returns a new instance of the entity class. When finished, use the execAsync
method to execute the query in the database and return the records as a .
The example below will return all the records and fields in the Categories
table in the Northwind
database.
Note, the execAsync
method returns a TypeScript Promise
so the await
keyword can be used to execute the query asynchronously.
To select fields from an entity, use the [entity]Field enum
parameters on the select
method.
The field
method can also be used to select fields.
To filter the records returned, use the eq
method.
To return the first record in a result set, the execFirstAsync
method can be used instead of the execAsync
method.
Note, unlike the execAsync
method which returns a data table, this method returns a single Categories
object.
When selecting a single cell in a query, the execScalerAsync
method can be used.
To order the records in the result set, use the orderBy
method.