How to generate auto id like PA-01-07-2012-0001. Where 01 is the Date of a month,07 is the Month, 2012 is the year, and 0001 is auto generate id and it will be increment. after that it will check The Generated id in database.And create a new id
rehanul.bappy
0
Newbie Poster
Recommended Answers
Jump to Postint id; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string ID = "PA-"+DateTime.Now.Day+"-"+DateTime.Now.Month+"-"+DateTime.Now.Year+"-"+id; id++; MessageBox.Show(ID); }
Jump to Post@superjj
So where does
id
value come from? Looks like you add a blank value there.Declared at the top and then used while blank if we assume no code isnt written there.
Jump to PostThe ID need to be recovert from the database.
Jump to PostAh fair enough then, also skimmed over the
12. id++;
on my first read through. :)
All 14 Replies
superjj
0
Light Poster
Mike Askew
131
Veteran Poster
Featured Poster
superjj
0
Light Poster
Mike Askew
131
Veteran Poster
Featured Poster
rehanul.bappy
0
Newbie Poster
Mike Askew
131
Veteran Poster
Featured Poster
rehanul.bappy
0
Newbie Poster
Mike Askew
131
Veteran Poster
Featured Poster
rehanul.bappy
0
Newbie Poster
M.Waqas Aslam
67
Posting Pro in Training
Featured Poster
rehanul.bappy
0
Newbie Poster
M.Waqas Aslam
67
Posting Pro in Training
Featured Poster
rehanul.bappy
0
Newbie Poster
ljbbq
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.