当前位置: 代码迷 >> ASP.NET >> ASP.NET日期处理的有关问题
  详细解决方案

ASP.NET日期处理的有关问题

热度:152   发布时间:2013-02-25 00:00:00.0
ASP.NET日期处理的问题
1.用两个TextBox输入两个日期,分别是txtStartDate和txtEndDate  
2.开始日期为:2007-08-01,结束日期为:2007-08-05  
3.问题:我需要把开始日期和结束日期之间的每一天插入到数据表.怎么做?谢谢!

------解决方案--------------------------------------------------------
DateTime start = new DateTime(2007, 8, 1);
DateTime end = new DateTime(2007, 8, 5);

DateTime temp = start;
while (true)
{
temp = temp.AddDays(1);
if (temp > end)
break;

//写入数据库
}
  相关解决方案