hi, can someone help me? i am using vb.net2010 and mssql as my database.
what i want to do is when i open the form, the database will auto increment the student id and show it on the text box.
Recommended Answers
Jump to PostYou will need to create table with an integer field with a default of 0.
On form_load you will want to pull the value from the database and add 1 to it.
On form_close you will want to save that value back to the database.
You can …
Jump to PostWe rarelly want to increment on form open or in any event other than the actual insert. The reason for this is that you are probably going to get either multiple records with the same id (if not set as unique in a multiuser environment) or one of your users …
Jump to PostYou can try loading the form, without getting the id.
When the user clicks "Save" you will retrieve the id then save.
That way you can prevent what adam_k is talking about.
The only way to receive the same key would be if they both press the …
Jump to PostIs this a multiuser environment? How many users/inserts per day or hour top?
What will you get out of displaying the next ID to be assigned? What do you plan to do with it?
All 13 Replies
Begginnerdev
256
Junior Poster
adam_k
239
Master Poster
trisha0906
10
Newbie Poster
trisha0906
10
Newbie Poster
Begginnerdev
256
Junior Poster
adam_k
239
Master Poster
trisha0906
10
Newbie Poster
adam_k
239
Master Poster
trisha0906
10
Newbie Poster
adam_k
239
Master Poster
poojavb
29
Junior Poster
poojavb
29
Junior Poster
trisha0906
10
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.