How to resolve: ''A TOP N or FETCH rowcount value may not be negative''

entity-framework entity-framework-6 sql sql-server

Accepted Answer

It seems thatNoOfMonthsBack is a positive number (such asint or float ). If you want to go back in time, you should utilise the formula negated. From the first line's comment:

var sDate = DateTime.Now.AddMonths(-NoOfMonthsBack).ToString("yyyyMMdd");
2
9/25/2018 12:30:52 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow