Retrieving Data

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Hi

I have some 10 records in a table with a DateTime field, all the records
have the same data but the time of each records is different.

Using a stored procedure how do i retrieve all records

eg AppendParameter(cmd, "@CallDate", DbType.DateTime, dt);

TIA
Barry
 
Back
Top