Skip to content

BizArk.Data.Extensions.DataExt

Brian Brewder edited this page Nov 13, 2018 · 1 revision

Back to BizArk.Data API Reference

Extension methods for DbCommand.

Methods

  • public static DbParameter AddParameter(this DbCommand cmd, string name, object value, bool setNull, DbType? dbType = null, int? size = null) - Adds a value to the end of the parameter collection. Any value that is interpreted as empty (ConvertEx.IsEmpty(val)) is set to DBNull.Value.
  • public static IEnumerable<DbParameter> AddParameters<T>(this DbCommand cmd, string paramNameRoot, params T[] values) - This will add an array of parameters to a DbCommand. This is used for an IN statement. Use the returned value for the IN part of your SQL call. (i.e. SELECT * FROM table WHERE field IN ({paramNameRoot}))
  • public static IEnumerable<DbParameter> AddParameters<T>(this DbCommand cmd, string paramNameRoot, IEnumerable<T> values, DbType? dbType = null, int? size = null) - This will add an array of parameters to a DbCommand. This is used for an IN statement. Use the returned value for the IN part of your SQL call. (i.e. SELECT * FROM table WHERE field IN ({paramNameRoot}))
  • public static IEnumerable<DbParameter> AddParameters(this DbCommand cmd, object parameters) - Adds the objects properties as parameters. Converts object to a property bag and then adds the values to the command as parameters.

Clone this wiki locally