Table of Contents

Method AddReturnParameter

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.MSSqlClient.dll

AddReturnParameter(SqlCommand, SqlDbType, string?)

Adds a typed return-value parameter to the command.

public static SqlParameter AddReturnParameter(this SqlCommand target, SqlDbType type, string? name = null)

Parameters

target SqlCommand

The command to add the parameter to.

type SqlDbType

The SqlDbType of the parameter.

name string

The optional name of the parameter.

Returns

SqlParameter

The created parameter, which has already been added to the command's parameter collection. Read its value after the command has executed.

Exceptions

ArgumentNullException

target is null.

ArgumentException

name is empty or white space.