问大家一个简单的问题??? 最笨的方法,根据nMaxID.ToString().Length的多少在其前面补0再插入库中 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 具体的函数我记不太清了,其实进行如下分支处理就行了:if (nMaxID<1000) maxID="0"+maxID;if (nMaxID<100) maxID="0"+maxID;字符串的合并记不太清了,你自己查一下 ojlovecd说的也是唯一可靠的方法 string getMaxID(int id){ id++; if (id.ToString().Length == 4) return id.ToString(); return new string('0', 4 - id.ToString().Length) + id;} string getMaxID(int id){ id++; return new string('0', 4 - id.ToString().Length) + id;}也可 Convert.ToInt32(maxId).ToString("0000"); int nMaxID= Convert.ToInt32(maxId) + 1 ; nMaxID.ToString("0000")哈哈楼上一样的 stulz c7000 通信协议问题 GDI裁切 Report报表中,Format属性如何设置成这样的效果 哪位大侠知道怎么样用C#.net 让PDF能够在网页上显示出来 急急!! c#报表问题 谁有.net 2005下可以使用的日期控件? 基本问题请教 获得登陆用户的iP c#實現Excel報表。炎急炎急 请教高手:使用C#开发B/S结构,即WebApplication时,如何保存附件(*.doc,*.xls,*.txt)等格式 树算法的问题,没分了,大家帮帮忙! 如何实现类似imagelist、timer这类不直接显示在窗体上的控件
if (nMaxID<1000)
maxID="0"+maxID;
if (nMaxID<100)
maxID="0"+maxID;
字符串的合并记不太清了,你自己查一下
string getMaxID(int id)
{
id++;
if (id.ToString().Length == 4) return id.ToString();
return new string('0', 4 - id.ToString().Length) + id;
}
{
id++;
return new string('0', 4 - id.ToString().Length) + id;
}
也可
nMaxID.ToString("0000")
哈哈楼上一样的