开发者

Generation of employee id

I have form empdetails like this

EmpId:textbox Name:textbox

username:textbox Password:textbox

I need to generate empid and it start with 0001 and display it in the empid field and all other information will be entered employee and i have provided save button when the user clicks on it it should be saved in the db and next time when the user clicks on this form it should display empid as 0002 and the process continues.When the user clicks on the s开发者_运维问答ave button it should be saved in the db and it should display in the gridview with id and name field made it as hyperlink.

Can any1 help me on this

With Regards, Sweety


If this is a single user application, you just have to make a max(id) sql to get the largest id and increase the number by one. Use a numberformatting class for the leading 0s.

If this is a multi user application (more than one user could open at the same time) you should create a new table which is made to automatically reserve the number for the time you are in this form. If you cancel the form, the number will be freed again and usable for the next opening. If you create a user, the state moves from open over reserved to used. This will prevent any doubleid errors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜