Docs / Use Output Parameters

Use Output Parameters

What this page covers#

This page shows how to use output parameters with MooParams.

Example#

using System.Data;

var parameters = new MooParams()
    .AddInt("@UserId", 42)
    .AddInt("@RowsAffected", null, ParameterDirection.Output)
    .AddNVarChar("@StatusMessage", null, 200

Key idea#

You add the parameter before execution, then read its value back from the same MooParams instance afterwards.

Notes#

  • use typed getters where possible
  • GetNullable... methods return null for DBNull
  • getters throw if the value cannot be read as the requested type