this thype endrollment number jenrate:'2012/0001'
plz help me .....
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
rakesh chaudhariPosted Aug 17, 2012, 3:06 AM
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();
}
}
}
Tarun BhalodiPosted Aug 17, 2012, 4:25 AM
also check for null at first time.....:)
Vimlesh MishraPosted Aug 17, 2012, 3:15 AM