.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
A newer version of this page is available. Switch to the current version.

Session.ExecuteSprocParametrized(String, SprocParameter[]) Method

Executes the specified stored procedure with the named parameters and returns its result set.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.2.dll


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


Name Type Description
sprocName String

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

parameters DevExpress.Xpo.DB.SprocParameter[]

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


Type Description

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


This method takes named parameters. The parameter order is arbitrary. The SprocParameter.Direction property should be set to Output for out parameters. Based on the current ADO.NET provider, the data type (SprocParameter.DbType), scale (SprocParameter.Scale) and precision (SprocParameter.Precision) may be required. If the stored procedure is a function, the resulting parameter with the SprocParameter.Direction property set to ReturnValue should be passed.

Out parameter values are returned in a supplementary ResultSet which includes two columns - parameter names and values. In the case where 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 ExecuteSprocParametrized method call.

SelectedData data = 
    session.ExecuteSprocParametrized("TestProc", new SprocParameter("@first", 123), new SprocParameter("@second", "abc"));

To visualize the result set returned by the ExecuteSprocParametrized method, use XPDataView. To learn how to access the resulting data, refer to How to: Access Data in SQL Query Results.

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

See Also