this thype endrollment number jenrate:'2012/0001'
plz help me .....
How genrate auto endrollment number regstrtion form load event ??
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
rakesh chaudhari57 reputationPosted Aug 16, 2012, 11:06 PM EDT
Take this code and genrate the number which u want if this will be usefull for u then reply me
on [email protected],[email protected]
string autoincrement = "SELECT MAX(MemberID)FROM [Member]";
cmd = new SqlCommand(autoincrement, Connection.GetConnection());
object autoinc = cmd.ExecuteScalar();
if (autoinc.ToString() == "")
{
// autoinc = 1;
}
else
{
string sentence = autoinc.ToString(); ;
string[] digits = Regex.Split(sentence, @"\D+");
foreach (string value in digits)
{
int number;
if (int.TryParse(value, out number))
{
string te = value;
autoinc = int.Parse(te.ToString()) + 0001;
string prefix="2012/";
string conct =prefix + "" + autoinc;
Your Label Value = conct.ToString();
}
}
}
Vimlesh Mishra113 reputationPosted Aug 16, 2012, 11:15 PM EDT
Tarun Bhalodi47 reputationPosted Aug 17, 2012, 12:25 AM EDT
also check for null at first time.....:)