开发者

Generation of employee id

开发者 https://www.devze.com 2023-04-09 00:52 出处:网络
I have form empdetails like this EmpId:textboxName:textbox username:textboxPassword:textbox I need to generate empid and it start with 0001 and display it in the empid field and all other informatio

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

精彩评论

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