年份更改如何更改计数 [英] year changes how to change the count
本文介绍了年份更改如何更改计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我需要帮助
Doid我是通过计算数据库中的记录数来获取的.
我的要求是,如果是新的一年,则计数必须重新从1开始
范例(2011)
2011scl001-D0
2011scl002-DO
2011scl003_Do
(2012)
Hi
I need a help
Doid I am getting by counting number of records in database.
My requirement is if it is a new year the count must start again from 1
Example(2011)
2011scl001-D0
2011scl002-DO
2011scl003_Do
(2012)
2012scl001-D0
2012scl002-DO
2012scl003_Do
您能提出建议吗?
Could u pls advice
if (count < 10)
{
if (month == 1)
{
DoId = (DateTime.Now.Year + cusId + ("00") + (count + 1) + "-DO").ToString();
}
else
{
DoId = (DateTime.Now.Year + cusId + ("00") + (count + 1) + "-DO").ToString();
}
}
谢谢
Thanks
推荐答案
我只是将if
子句中的count重置为1.
I would just reset count to 1 in theif
clause.
if (month == 1)
{
count=1;
DoId = (DateTime.Now.Year + cusId + ("00") + (count + 1) + "-DO").ToString();
}
else
{
DoId = (DateTime.Now.Year + cusId + ("00") + (count + 1) + "-DO").ToString();
}
这篇关于年份更改如何更改计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文