G
Guest
You need to search from an to. For you where clause, do
Where thedatefield >= @from and thedatefield < @to
and parse in from c#
AppendParameter(cmd, "@from", DbType.DateTime, dt.Date);
AppendParameter(cmd, "@to", DbType.DateTime, dt.Date.AddDays(1));
Or you could do the date conversion in the stored proc. There are various
ways to do this. Some I have seen are making @from by converting the calldate
passed in to a varchar with no time in it, and making @to with the same
varchar + '23:59:59'.
Or converting to an int and back for @from and then DATEADD'ing a day to get
@to.
Its up to you
Ciaran O'Donnell
Where thedatefield >= @from and thedatefield < @to
and parse in from c#
AppendParameter(cmd, "@from", DbType.DateTime, dt.Date);
AppendParameter(cmd, "@to", DbType.DateTime, dt.Date.AddDays(1));
Or you could do the date conversion in the stored proc. There are various
ways to do this. Some I have seen are making @from by converting the calldate
passed in to a varchar with no time in it, and making @to with the same
varchar + '23:59:59'.
Or converting to an int and back for @from and then DATEADD'ing a day to get
@to.
Its up to you
Ciaran O'Donnell