Execute
To execute a stored procedure using an ORM class, start with the name of the class and then call the procedure
method. When finished, use the execAsync
method to run the stored procedure in the database and return the records as a WireBootstrap DataTable.
The following example runs the Ten Most Expensive Products
stored procedure in the Northwind database and returns the results as a data table.
Note, the execAsync
method returns a TypeScript Promise
so the await
keyword can be used to run the stored procedure asynchronously.
Parameters
To add parameters to the stored procedure, use the param
method.
The following example calls the CustOrderHist
stored procedure using THEBI
as the value for the CustomerId
parameter.
The following example executes a query for the first record in the Customers
table and then uses the CustomerId
value from the record as the parameter when running the CustOrderHist
stored procedure.
Typed Results
Stored procedures don't published the schema of their results. However, the ORM entity has a data table interface and object class that allow the fields in the results to be added.
The naming convention for the data table interface is I[entity]DataTable and [entity]Row for an individual result record.
Once these properties are set on the Row class, use the execAsyncRows
method to return the same data table with each row strongly-typed as Row objects.
Last updated