在FOR循环中产生疑问. [英] doubt in FOR loop urgent .

查看:78
本文介绍了在FOR循环中产生疑问.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DateTime sdate = Convert.ToDateTime(amcsdate.Text);

DateTime sdate=Convert.ToDateTime(amcsdate.Text);

DateTime edate = Convert.ToDateTime(amcedate.Text);

DateTime edate=Convert.ToDateTime(amcedate.Text);

DateTime i;

DateTime i;


for(i = sdate; i< edate; i = i.AddMonths(1))
{


for(i=sdate;i<=edate;i=i.AddMonths(1))
{

Response.Write(i);

Response.Write(i);


}

上面的编码工作正常.如何将i的值存储在不同的变量(例如d1,d2,d3等)中.

above coding works fine . how to store the values of i in different variable like d1,d2,d3 etc.

示例:

日期= 2006年7月3日

sdate = jul 03 2006

edate = 2007年7月3日

edate = jul 03 2007

现在我想将i的值存储在其中

now i want to store the value of i in

d1,d2,d3,d4 .........等等,直到我< = edate.得到d1,d2等的值后,我将存储在数据库中.

d1,d2,d3,d4.........etc till i <= edate . after getting the values of d1,d2 etc i will be storing in database .


我的表格式:

d1 d1 d2 d2 d3 d3 d4 d4等等............ 2006年03月2006年03月03日p>


my table format :
 
          d1              d2             d3          d4         etc  ............
        jul 03 2006   Aug 03 2006    Sep 03 2006   Oct 03 2006

推荐答案

对于您的问题,我没有答案,但是,我认为如果ppl知道您有一个问题,我会更容易解决.您可以在其中使用代码示例,也许您应该选中该帖子包含代码的框,以便ppl能够看到此信息,并可能会更快地为您提供帮助,例如增加点击次数.只要我的0.02

I do not have an answer for your issue, however, I think i would be easier for ppl to resolve if they knew you had a code samle available in which you do, maybe you should have seleted the box that the post included code sot that ppl would see this and possible help you out quicker, like increase the amount of clicks..just my 0.02


这篇关于在FOR循环中产生疑问.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆