nHydrate.Generator.DatabaseHelper.SetParameterValue C# (CSharp) Method

SetParameterValue() public static method

public static SetParameterValue ( IDbCommand command, string paramName, object inValue ) : void
command IDbCommand
paramName string
inValue object
return void
        public static void SetParameterValue(IDbCommand command, string paramName, object inValue)
        {
            try
            {
                var currentParam = (IDbDataParameter)command.Parameters[paramName];
                if (currentParam != null)
                {
                    currentParam.Value = inValue;
                }
                else
                {
                    throw new Exception("Parameter: " + paramName + " is missing from stored procedure: " + command.CommandText);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Parameter: " + paramName + " is missing from stored procedure: " + command.CommandText, ex);
            }
        }