Avatar of D Patel
D Patel
Flag for India asked on

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

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
ASP.NETVisual Basic.NETMySQL Server

Avatar of undefined
Last Comment
D Patel

8/22/2022 - Mon
Dorababu M

Once the number generated it could not be repeat are you storing the generated number some where?
D Patel

ASKER
Yes in MySQL table
Ryan Chong

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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
D Patel

ASKER
Can you please brief about it more Ryan Chong?
ASKER CERTIFIED SOLUTION
Ryan Chong

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
D Patel

ASKER
Thanks for your support.