This probably isn't a wise idea to show this number. There are a couple of ways to go about this:
do: select max(keyfield) + 1 from table This is a dirty solution your not garantied that this id will be the id which will be used. Because if the last record is deleted then the next record will be: max(keyfield) + 2 from table another way would be to insert a record using a transaction using select scope_identity() to get the last id. Then rolling back the transaction. Keep in mind though that when 2 people access the page that when one of them inserts a new field the id for the other one will automaticly be invalid. ----- Original Message ----- From: "hitesh c" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, January 17, 2005 7:30 AM Subject: [AspNetAnyQuestionIsOk] next primary key value........ > > hi, > here's my question....in a webform when the user > clicks an add new record to the DB button....the > Primary keyfield(is readonly...cannot be changed by > the user) in the form shows the value before > insertion.....also the Primary Key in the DB is > IDENTITY....plz help Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
