I am working on a small project that capture customer details, Using C Sharp in Visual Studio 2010 and a SQL database.
Now i need to make my customer ID to be stored as follow, The ID needs to consist of one alphabetic characters A, B, C, D or E followed by EXACTLY EIGHT Numeric digits, these number needs to be left padded with zeroes to have exactly eight digits.
Random r1 = new Random();
int num = r1.Next(0, 99999999); // generate random number
string number = string.Format("{0:D8}", num);
Random r2 = new Random();
int num2 = r2.Next(0, 26); // generate random letter
char letter = (char)('A' + num2);
string id = letter + number; // join both as ID
generated number may not unique, when inserting new record you may need to check whether generated ID already exist or not.