Hello Gents

I have a small problem and hope someone ca help me.

I wrote a small code to generate auto-increment number and save it to the database. the problems is that whrn it reaches 10, it stops incrementing

hereis the code

Dim Separ As String() = fullString.Split("-")

        Dim StrPart As String = String.Format(Separ(0), "ABC", System.String.Format("SIM"))
        Dim intPart As Integer = Convert.ToInt32(Separ(1))
        Dim Novonumero As String = String.Empty

        Novonumero = String.Format("{0}-{1}", Separ(0), System.Threading.Interlocked.Increment(intPart), 1)
        lblTicketNumber.Text = Novonumero

can anyone help me?
Thank You

what is the datatype??...if the datatype is varchar / text it wont increment beyond 10....same had happened with me....

I had to take int as the datatype and then increment it....

Edited 4 Years Ago by poojavb

Hi

Thanks for you answer and I appreciate the tip.
just one question, How am I supposed to save this: SIM-1 as integer

regards

Just an idea...

I had to save the data as INP1 - first 3 characters and last integer

We cant save the alphanumeric as integer

but what I had done was....I had one temp table....which had the integer value...
every time I need to increment the value I used to check the value in that table and update in my new table....that had datatype as varchar...so everytime it used to get incremented correctly....after the insert statement then update the temp table by 1....

This question has already been answered. Start a new discussion instead.