asp.net How to get all dates between startingdate and endingdate

Posted by Vanchi050585 under ASP.NET on 11/29/2010 | Points: 10 | Views : 1223 | Status : [Member] | Replies : 2
hi all,

i have two dates starting date and ending date.

i want to get all dates between startingdate and endingdate.

pls help me.

Thanks
tvn



Responses

Posted by: T.saravanan on: 11/29/2010 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi Vanchi,

Your question is not clear.

If you filter a data from datatable means refer the following code (using c# Front End)

// Here dtData --> Your DataTable
DataRow[ ] drRow;

DataTable dtTemp = dtData.Clone();
string sCond=string.Format("{0} >= '{1}' and {0} <= '{2}'", DateColumn, startingDate, EndingDate);
drRow = dtData.Select(sCond,"DateColumn");
if(drRow.Length > 0)
{
dtTemp = drRow.CopyToDataTable();
}
else
{
dtTemp = null;
}
// dtTemp value is your filter output.


If you using SqlServer means (Back End)

select * from table where DateColumn between 'StartingDate' and 'EndingDate' 


Try this way...

Cheers :)


Thanks,
T.Saravanan

Vanchi050585, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response