예제 #1
0
        public static SqlClause AddBetween(this SqlClause sqlClause,
                                           [NotNull] string columnName,
                                           [CanBeNull] IDbDataParameter parameter,
                                           [CanBeNull] IDbDataParameter parameter2)
        {
            if (parameter == null && parameter2 == null)
            {
                return(sqlClause);
            }

            if (parameter == null)
            {
                return(sqlClause.AddLessOrEquals(columnName, parameter2));
            }

            if (parameter2 == null)
            {
                return(sqlClause.AddGreaterOrEquals(columnName, parameter));
            }

            sqlClause.Add(columnName + " between " + parameter.ParameterName + " and " + parameter2.ParameterName);
            sqlClause.Add(parameter);
            sqlClause.Add(parameter2);

            return(sqlClause);
        }