需要形成一个自动生成的ID字段 [英] need a Autogenerated ID field in form

查看:94
本文介绍了需要形成一个自动生成的ID字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户点击提交按钮这一切都不会发生。

This all will happen when the user hits the submit button

我的要求:ID格式应该是FF-YY-00001-A(这是表的字段)

My requirement : ID Format should be FF-YY-00001-A (this is the field of the table)

1 FF是快捷方式名称

1 FF is the shortcut Name

2.YY是当前的日期,我想保存此表为一年领域,因此,这将有助于追查报告,条件:我必须采取一年即最后一部分假设2013 => 2014年13 => 14

2.YY is the Current Date and I want to save this in table as year field ,so that it will help to track down the reports, condition: I have to take the last part of the year ie suppose 2013=> 13 2014=> 14

下一个字段是自动增量字段中,为此它应生成和增加一
我米想,这个值可以来自自动增量字段从像序列号表。像sr.no = 1我们可以把这个字段00001或00001 1(应该会更好,如果我们可以)

next field is autoincrement field ,for this it should be generated and incremented by one I m thinking ,this value can come from the autoincrement field from table like Serial no. like sr.no=1 we can take this field 00001 or 1 00001 (should be better if we can)

我们也有这个值递增到1 [*我们得为对比的previous价值,我们可以用最后的记录和字段sr.no的帮助下做]

also we have to increment this value to 1 [* We have to get the previous value for the comparision and we can do with help of last record and field sr.no]

4.A / B / C / D是来自用户的选择

4.A/B/C/D is the option from the user

这毕竟

现在我们的ID应该是FF-13-1-A下一个:FF-13-2-B下一个条目:FF-13-3-C

now our ID should be FF-13-1-A next: FF-13-2-B next entry: FF-13-3-C

请注意:我们必须考虑的破折号( - )也即我们的ID格式,包括短跑,即( - )

Note: We have to consider the Dash (-) also ie our ID Format includes Dash ie (-)

提交后按钮:

A)ID字段将被更新,例如:FF-YY-00001
B)自动增量场Sr.no得到值的例子:像1℃),年字段将被更新的例子:像2013

a) ID Field will be updated example: FF-YY-00001 b) Autoincrement field Sr.no gets the value example: like 1 c)year field will be updated example: like 2013

希望你会明白的要求

推荐答案

也许这将帮助您:

int clientId = 3;
int otherId = 4

var id = String.Format("FF-{0}-{1:D5}-A", otherId, clientID);

在这里可以设置用字母代替FF作为{arg}里。你可以通过调用获得的DropDownList 的值 dropdownlist.SelectedValue

+

<一个href=\"http://stackoverflow.com/questions/314466/generating-an-array-of-letters-in-the-alphabet-in-c-sharp\">Generating信在C#字母数组

这篇关于需要形成一个自动生成的ID字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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