Click here to Skip to main content
13,096,399 members (52,265 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi friends,
I created sql table with studentID column as a autoincreamented I want to show the Id from sql to textbox.Before any insertion of data there is no Id on the table. At that time I want show First value in textbox and then show next autoincremented value from sql table for every insertion.Plase help me how can i do this.
Thanks in advance
Posted 12-Oct-12 21:20pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Stop and think about it.
Why are you showing the value at all? So that people know what value will be assigned to the new record they are creating. But the main reason for using SQL is that it supports multiple users at the same time, so the "next value" won't be the next one - that value may have been used by a different user two hours ago.

That leads to confusion - only show information when it will be correct - which in the case of auto incremented data is only after the record has been inserted correctly.

If you need to give the user the record id, then there is probably something wrong with your data design.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 13 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100