drone11
03-28-2008, 10:25 PM
I was wondering if someone can help me out on this. Is there a better way to do this. I have a UserId that consit of a varchar(6). Lets say the first member is A00001. Yet when I try to create a new member on an asp page I want the next available spot which would be A00002. The problem is that I dont want to use for example (A & "0000" & Num) to get A00003. Because at the end if I get to the 10th memberID it would come out with an extra 0 or would it pop out an error message. I want it to come out A00010 and for A00999 to turn to A01000 and so forth. I am new to programming so bare with me. Thanx.
Here is what I got:
Me.lblNumMiembro.Text = dt.Rows.Item(dt.Rows.Count - 1).Item(0) //Here I would get "A00009"
Now all I need is a method that divides this last string ("A00009") acquired from a stored procedure
A method that divides it into (A + 000 +09). Then with this method add 1 more which will be A + 000 + 10)
Which in the end returns this number "A00010" which I will later assign it to Me.lblNumMiembro.Text= newNum
Can anyone show me a method or vbcode that does this. I mean the code behind dividing the string and turning it into an integer and finally incrementing it by 1 to have the result of A00010. Then when I ask it again it will display A00011
Here is what I got:
Me.lblNumMiembro.Text = dt.Rows.Item(dt.Rows.Count - 1).Item(0) //Here I would get "A00009"
Now all I need is a method that divides this last string ("A00009") acquired from a stored procedure
A method that divides it into (A + 000 +09). Then with this method add 1 more which will be A + 000 + 10)
Which in the end returns this number "A00010" which I will later assign it to Me.lblNumMiembro.Text= newNum
Can anyone show me a method or vbcode that does this. I mean the code behind dividing the string and turning it into an integer and finally incrementing it by 1 to have the result of A00010. Then when I ask it again it will display A00011