循环通过gridview,检查值和更新 [英] loop through gridview, check values, and update
问题描述
我在我的gridview行中循环,并检查每行中几列的值。
我有一个通知栏(日期)和一个EndDate专栏(日期)。我想要做的是:如果row1的通知日期是今天,那么我想在同一行中选择enddate colum值并在其日期添加一年,然后用新值更新enddate。
我可以得到我需要的列的值,但我不确定如何将年份添加到日期并更新它。
有谁可以给我一个关于如何做到这一点的简短说明?
I am Looping through my gridview row, and checking the values of a couple columns in each row.
I have a Notice Column (date) and an EndDate Column (date). What I want to do is: if the notice date for row1 is Today then i want to select the enddate colum value in the same row and add one year to its date, then update the enddate with the new value.
I can get the values of the columns i need, but i''m not exactly sure how to add the year to the date and update it.
can anyone give me a short rundown on how to do this?
推荐答案
这应该有帮助,
http ://msdn.microsoft.com/en-us/library/system.datetime.addyears.aspx [ ^ ]
This should help,
http://msdn.microsoft.com/en-us/library/system.datetime.addyears.aspx[^]
这篇关于循环通过gridview,检查值和更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!