Reference
Execute
The Execute
method is used to synchronously execute a SQL statement against a database.
For any query or stored procedure
Syntax
Execute(
[{commandTimeout}]
[,{connection}]
)
Arguments
- commandTimeout
- – The execution duration (in seconds) of a query before execution will timeout if not yet complete.
- connection
- – A SQL connection to use for query execution. dbExpression will open the connection if it isn't already open, and will honor a transaction if one has been started on an open connection.
For SelectOne
or SelectMany
queries and stored procedures
Syntax
Execute(
[{commandTimeout}]
[,{connection}]
[,{read|map}]
)
Arguments
- commandTimeout
- – The execution duration (in seconds) of a query before execution will timeout if not yet complete.
- connection
- – A SQL connection to use for query execution. dbExpression will open the connection if it isn't already open, and will honor a transaction if one has been started on an open connection.
- read
- – A delegate that enables you to take full control of the data reader returned from execution. Invocations using this parameter DO NOT have a method return.
- map
- – A delegate that enables you to take control of the mapping of rowset data. Invocations using this parameter return value(s), you specify what it returns by the generic parameter `T`.
syntax examples