Home All Groups Group Topic Archive Search About
Author
14 Nov 2006 10:47 AM
Barry
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

Author
14 Nov 2006 10:45 AM
Ciaran O''Donnell
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

Show quote
"Barry" wrote:

> 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
>
>
>

AddThis Social Bookmark Button