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

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

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

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

            return(sqlClause);
        }