The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.ExecuteSproc(String, OperandValue[]) Method

Executes the specified stored procedure and returns its result set.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.1.dll

Declaration

public SelectedData ExecuteSproc(string sprocName, params OperandValue[] parameters)
Public Function ExecuteSproc(sprocName As String, ParamArray parameters As OperandValue()) As SelectedData
public SelectedData ExecuteSproc(string sprocName, params OperandValue[] parameters)
Public Function ExecuteSproc(sprocName As String, ParamArray parameters As OperandValue()) As SelectedData

Parameters

Name Type Description
sprocName String

A String value that specifies the stored procedure's name.

parameters OperandValue[]

An array of OperandValue objects specifying parameters to pass to the stored procedure.

Parameters

Name Type Description
sprocName String

A String value that specifies the stored procedure's name.

parameters OperandValue[]

An array of OperandValue objects specifying parameters to pass to the stored procedure.

Returns

Type Description
SelectedData

A SelectedData object specifying the result set returned by the specified stored procedure.

Returns

Type Description
SelectedData

A SelectedData object specifying the result set returned by the specified stored procedure.

Remarks

This method takes in or in-out parameters. The paramerers array order should match the parameters order in the stored procedure's signature. Out parameter values are returned in a supplementary ResultSet which includes two columns - parameter names and values. In this case the procedure returns nothing but out parameter values, the first result set will be empty and the second will contain result values. In the case where the stored procedure is a function, one more ResultSet, which contains a single cell with the function result, is returned.

Below is an example of a ExecuteSproc method call.


SelectedData data = 
    session.ExecuteSproc("TestProc", new OperandValue(123), new OperandValue("abc"));

To visualize the result set returned by the ExecuteSproc method, use XPDataView. To learn how to access the resulting data, refer to How to: Access Data in SQL Query Results. For example, you can bind the GridControl control to the ExecuteSproc result as follows:


using DevExpress.Xpo;
using DevExpress.Xpo.DB;
// ...
SelectedData sprocData = session.ExecuteSproc("MySproc");
gridControl1.DataSource = new XPDataView(session.Dictionary, session.GetClassInfo(typeof(MySproc)), sprocData);

To learn more about executing stored procedures in XPO, refer to Stored Procedures.

Note

You can avoid an extra request that fills the parameters list and improve performance by using the Session.ExecuteSprocParametrized method instead of ExecuteSproc.

See Also