hello,
i want to get thedata from database yestday 6pm to today 6pm.
how can i write code using c#.net and sql 2005 plz helpme...
hello,
i want to get thedata from database yestday 6pm to today 6pm.
how can i write code using c#.net and sql 2005 plz helpme...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dipal ChoksiPosted May 19, 2008, 2:43 AM
Blocked AccountPosted May 19, 2008, 2:31 AM
U can do this by writing the stored procedure like that.
declare @PreviousDate varchar(30)
declare @CurrentDate varchar(30)
set @PreviousDate = (select convert (varchar(30),getdate()-1,101)+' 18:00:00.000' )
set @CurrentDate = (select convert (varchar(30),getdate(),101)+' 18:00:00.000' )
select * from TableName where CreatedDate between @PreviousDate and @CurrentDate
Johnny GCPosted May 19, 2008, 2:11 AM
DateTime minus1day = DateTime.Now().AddDays(-1);
minus1day = new DateTime(minus1day.Year, minus1day.Month, minus1day.Day, 18, 0, 0);
Johnny.