Increment a count

B

bthumber

I had an application method that counts the total number of records that like
for example buffal. From 0-99 things work find, see the code:

int count = (int)Session["hostCount"];

if ((count >= 0) && (count <= 98))
{
count++;

SequenceNumbers sn = new SequenceNumbers();
lblSubStr.Text = sn.GetNumberSequence(count);
}

// first record would be buffal01, last record buffal99, next record should
be buffala1.

If that test fails the sequence of characters and numbers runs, a1, a2,
a3...z9. At this point there are 99 records in the database and the "count"
is 99. If I start the count at 99 then increment if by it will be 100 and the
sequence will start at l2, so I need to reset the count to start at 0 so that
the next record buffala1, see code:

else if ((count >= 0) && (count <= 233))

{// got to increment this somewhere
count = 0;

AlphaNumberSeq ans = new AlphaNumberSeq();
lblSubStr.Text = ans.GetAlphaNumberSeq(count);

}

How can I start the AlphaNumberSeq to zero and increment the count each time?
 
I

Ignacio Machin ( .NET/ C# MVP )

I had an application method that counts the total number of records that like
for example buffal. From 0-99 things work find, see the code:

        int count = (int)Session["hostCount"];

        if ((count >= 0) && (count <= 98))
        {
            count++;

            SequenceNumbers sn = new SequenceNumbers();
            lblSubStr.Text = sn.GetNumberSequence(count);
        }

// first record would be buffal01, last record buffal99, next record should
be buffala1.

If that test fails the sequence of characters and numbers runs, a1, a2,
a3...z9. At this point there are 99 records in the database and the "count"
is 99. If I start the count at 99 then increment if by it will be 100 andthe
sequence will start at l2, so I need to reset the count to start at 0 so that
the next record buffala1, see code:

        else if ((count >= 0) && (count <= 233))

        {// got to increment this somewhere
            count = 0;

            AlphaNumberSeq ans = new AlphaNumberSeq();
            lblSubStr.Text = ans.GetAlphaNumberSeq(count);

        }

How can I start the AlphaNumberSeq to zero and increment the count each time?

Hi,

It's not clear what you want from your post.
 
I

Ignacio Machin ( .NET/ C# MVP )

I had an application method that counts the total number of records that like
for example buffal. From 0-99 things work find, see the code:

        int count = (int)Session["hostCount"];

        if ((count >= 0) && (count <= 98))
        {
            count++;

            SequenceNumbers sn = new SequenceNumbers();
            lblSubStr.Text = sn.GetNumberSequence(count);
        }

// first record would be buffal01, last record buffal99, next record should
be buffala1.

If that test fails the sequence of characters and numbers runs, a1, a2,
a3...z9. At this point there are 99 records in the database and the "count"
is 99. If I start the count at 99 then increment if by it will be 100 andthe
sequence will start at l2, so I need to reset the count to start at 0 so that
the next record buffala1, see code:

        else if ((count >= 0) && (count <= 233))

        {// got to increment this somewhere
            count = 0;

            AlphaNumberSeq ans = new AlphaNumberSeq();
            lblSubStr.Text = ans.GetAlphaNumberSeq(count);

        }

How can I start the AlphaNumberSeq to zero and increment the count each time?

Hi,

It's not clear what you want from your post.
 
F

Family Tree Mike

bthumber said:
I had an application method that counts the total number of records that like
for example buffal. From 0-99 things work find, see the code:

int count = (int)Session["hostCount"];

if ((count >= 0) && (count <= 98))
{
count++;

SequenceNumbers sn = new SequenceNumbers();
lblSubStr.Text = sn.GetNumberSequence(count);
}

// first record would be buffal01, last record buffal99, next record should
be buffala1.

If that test fails the sequence of characters and numbers runs, a1, a2,
a3...z9. At this point there are 99 records in the database and the "count"
is 99. If I start the count at 99 then increment if by it will be 100 and the
sequence will start at l2, so I need to reset the count to start at 0 so that
the next record buffala1, see code:

else if ((count >= 0) && (count <= 233))

{// got to increment this somewhere
count = 0;

AlphaNumberSeq ans = new AlphaNumberSeq();
lblSubStr.Text = ans.GetAlphaNumberSeq(count);

}

How can I start the AlphaNumberSeq to zero and increment the count each time?

Are SequenceNumbers and AlphaNumbersSeq classes that you wrote? I cannot
find anything about them.

Mike
 
F

Family Tree Mike

bthumber said:
I had an application method that counts the total number of records that like
for example buffal. From 0-99 things work find, see the code:

int count = (int)Session["hostCount"];

if ((count >= 0) && (count <= 98))
{
count++;

SequenceNumbers sn = new SequenceNumbers();
lblSubStr.Text = sn.GetNumberSequence(count);
}

// first record would be buffal01, last record buffal99, next record should
be buffala1.

If that test fails the sequence of characters and numbers runs, a1, a2,
a3...z9. At this point there are 99 records in the database and the "count"
is 99. If I start the count at 99 then increment if by it will be 100 and the
sequence will start at l2, so I need to reset the count to start at 0 so that
the next record buffala1, see code:

else if ((count >= 0) && (count <= 233))

{// got to increment this somewhere
count = 0;

AlphaNumberSeq ans = new AlphaNumberSeq();
lblSubStr.Text = ans.GetAlphaNumberSeq(count);

}

How can I start the AlphaNumberSeq to zero and increment the count each time?

Are SequenceNumbers and AlphaNumbersSeq classes that you wrote? I cannot
find anything about them.

Mike
 
B

Ben Voigt [C++ MVP]

bthumber said:
I had an application method that counts the total number of records that
like
for example buffal. From 0-99 things work find, see the code:

int count = (int)Session["hostCount"];

if ((count >= 0) && (count <= 98))
{
count++;

SequenceNumbers sn = new SequenceNumbers();
lblSubStr.Text = sn.GetNumberSequence(count);
}

// first record would be buffal01, last record buffal99, next record
should
be buffala1.

If that test fails the sequence of characters and numbers runs, a1, a2,
a3...z9. At this point there are 99 records in the database and the
"count"
is 99. If I start the count at 99 then increment if by it will be 100 and
the
sequence will start at l2, so I need to reset the count to start at 0 so
that
the next record buffala1, see code:

else if ((count >= 0) && (count <= 233))

{// got to increment this somewhere
count = 0;

AlphaNumberSeq ans = new AlphaNumberSeq();
lblSubStr.Text = ans.GetAlphaNumberSeq(count);

}

How can I start the AlphaNumberSeq to zero and increment the count each
time?

Just let count keep going up, and use ans.GetAlphaNumberSeq(count-100) ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top