SqlHelper..::..ExecuteXmlReaderAsync Method (SqlConnection, CommandType, String, array<SqlParameter>[]()[][])

Execute a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameters.

Namespace:  Core
Assembly:  Core (in Core.dll)

Syntax


public static Task<XmlReader> ExecuteXmlReaderAsync(
	SqlConnection connection,
	CommandType commandType,
	string commandText,
	params SqlParameter[] commandParameters
)

Parameters

connection
Type: SqlConnection
A valid SqlConnection
commandType
Type: CommandType
The CommandType (stored procedure, text, etc.)
commandText
Type: String
The stored procedure name or T-SQL command using "FOR XML AUTO"
commandParameters
Type: array<SqlParameter>[]()[][]
An array of SqlParamters used to execute the command

Return Value

An XmlReader containing the resultset generated by the command

Exceptions


ExceptionCondition
ArgumentNullExceptionconnection

Remarks


e.g.: XmlReader r = ExecuteXmlReaderAsync(conn, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24));