Saturday, August 30, 2014

Selecting records between two dates nothing show although it have records in database why

Be careful with your query: you are writing <=@StartDate when it should be >=@StartDate.


Also, keep in mind another peculiarity when you pass the parameters from C#: The hours, minutes and seconds get appended to the date, contrary to what happens when you test it in query analyzer. This might exclude from the results a row that would otherwise match the bounds of your search.


No comments:

Post a Comment