Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to Insert the admission form of a student.
When i insert this from at that click this admission no is need to be increesed..
For different insertion it values will be mustly increesed...

For Example 1st form insertion click, AdmNo is: Adm0001
2nd form insertion click, AdmNo is: Adm0002
3rd form insertion click, AdmNo is: Adm0003......
Like this.
Any one Pls help me
Posted
Comments
Nilesh Patil Kolhapur 26-Apr-12 6:06am    
increased from database or program?
Mohamed Mitwalli 26-Apr-12 6:46am    
hi is the digit number will always be 4 digit like 0001 , 0002 and so on ?
shwetha1 26-Apr-12 7:38am    
Increased from program that will be stored on that database as Record by record
shwetha1 26-Apr-12 7:39am    
Its Not Necessary to number as 4 digits but its must to increment for every submission

For the requirement specified in the question, I think a public variable for AdmnNo can be declared and its value is incremented in each click of the button as shown below, and the AdmId is generated using string.Format
C#
int AdmnNo = 0;
//Within the click event of the button
string AdmnId = string.Format("Adm{0:0000}",++AdmnNo);
Console.WriteLine (AdmnId);
 
Share this answer
 
v2
Comments
[no name] 26-Apr-12 7:08am    
Yes
VJ Reddy 26-Apr-12 7:08am    
Thank you, Wes.
Vipin_Arora 26-Apr-12 7:10am    
+5
VJ Reddy 26-Apr-12 7:14am    
Thank you, Vipin.
shwetha1 26-Apr-12 7:37am    
Thanks for ur answer but for every insertion it will take Admno:AdmNo0001 only...
Hi
you have to set in your table
Set the Field AdmNo as Primary Key and


set Identity Specification as Yes
IsIdentity as Yes
Increment By 1

the above can see by right clicking the table->design


hope this help you
 
Share this answer
 
Comments
shwetha1 26-Apr-12 6:31am    
Thanks for u r Reply But I dont need to set any Identity Specification for my Table Is this possible?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900