We help IT Professionals succeed at work.

ASP.NET : Generate Unique Number of length 4 alphanumeric length where first character always start with alphabet

158 Views
Last Modified: 2017-11-20
Hi EE,

I need help in generating the Unique Number of 4 character length.

Criteria is as follows :
  1. String will always start with alphabet
  2. Another 3 characters will be a combination of alphabets (A-Z) and digits (0-9)
  3. Once the number generated it could not be repeat

Example
A001, A999, ZD01, DA9P, SXS8 etc...

I need to write a logic for the same in my ASP.NET (VB.NET) based web application.

Please provide a direction.

Regards,
D Patel
Comment
Watch Question

Dorababu MTechnical Lead
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
Once the number generated it could not be repeat are you storing the generated number some where?
D PatelD Patel, Software Engineer

Author

Commented:
Yes in MySQL table
CERTIFIED EXPERT

Commented:
thinking to have a stored procedure for data insertion and then build the logic for your field accordingly there?

then in your VB.NET program, you can call that stored procedure for data insertion.
D PatelD Patel, Software Engineer

Author

Commented:
Can you please brief about it more Ryan Chong?
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
D PatelD Patel, Software Engineer

Author

Commented:
Thanks for your support.