Click here to Skip to main content
15,908,661 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi I want to the coding auto generating number
Example
the number is: 11060001
11-means current year 2011(want to only 11)
06-means current month june
0001-means auto increment number.
This four digit number April 01 want to start and march 31 want to finished,
again next year start 0001
please give me the coding
Regards
Prakash
Posted
Comments
Smithers-Jones 18-Jun-11 10:44am    
Reasons for my vote of 1: no effort, "gimmecode"-post

Sorry, we can't really give you code for that - it depends on your environment. Where are you going to store the auto increment? Is this multiuser or single user? What happens if you exceed 9999 in any given year? etc. etc.

Think about what you are trying to achieve, and how you can support that.
 
Share this answer
 
Hi this code generate a password
I think you need this
private string RandomString(int size)
        {
            StringBuilder builder = new StringBuilder();
            Random random = new Random();
            char ch;
            int size1;
            if (size == 0)
                size1 = 6;
            else size1 = size;
            for (int i = 0; i < size1; i++)
            {
                ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26* random.NextDouble() +97)));
                builder.Append(ch);
            }

            return builder.ToString();
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900