The StoredProcedure class is used as a bridge between a SQL sproc and the calling .NET code.
Namespace:
Phoenix.DALAssembly: Phoenix.DAL (in Phoenix.DAL.dll) Version: 2.9.3209.25656 (2.9.0.0)
Syntax
| C# |
|---|
public class StoredProcedure : IDisposable |
Remarks
Remarks
Sql parameters are added in one of two modes, depending on which constructor is used.
Named parameters:
- Parameters are implemented as a SqlParameter[] array.
Unnamed parameters:
- Implemented as an object[] array.
- No output parameters are allowed.
- Must ensure parameters are added to the sproc object in the order they are expected in the sql sproc.
Examples
The following code instantiates a StoredProcedure object and adds to parameters. The stored procedure is then executed and the resulting DataSet is returned.
StoredProcedure sproc = new StoredProcedure("px_dl_announcement_getRecent"); sproc.AddInput(new SqlParameter("@workspaceID", workspaceId)); sproc.AddInput(new SqlParameter("@PageSize", numberOfItems)); return sproc.ExecuteDataSet();
