Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2010, 10:12 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default About ID identities

Hello,

Normally an Id identities to Yes is supposed to go from 1..2..3..4..5..etc. which mean it increment by 1 each time.

However, when entering the Review records.. i push the Enter key in the middle of one record which cause some kind of error message saying there was no commit, etc.. so i continued entering the record then went to the second line and used Ctrl+R to save the record by executing the query.

But it passed from 1 to 3... at the Id. Is there a way to rearrange the Ids.. so it go from 1 to etc..

Thanks.
 
Old April 29th, 2010, 10:26 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Yes, sometimes when an error occurs, the ID is already incremented.

Typically, you should be OK with this and not bother about gaps. It will make life a lot easier if gaps in IDs are no problem.

Otherwise, you can delete the records with a higher ID, and set the Identity Seed on the table to the lowest ID available + one.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Rushino (April 29th, 2010)
 
Old April 29th, 2010, 03:13 PM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default

Alright thanks!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserted Identities hossrad SQL Server 2005 1 May 21st, 2007 09:48 AM
How to get the callers ID umair_rathore Pro VB 6 0 April 16th, 2007 11:23 AM
'this.ID = id;' in class construction holf BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 October 6th, 2006 10:58 AM
ID crmpicco HTML Code Clinic 5 February 10th, 2005 11:50 AM
why not index.asp?id=1 can be www.myweb.com/?id=1 BurhanKhan Classic ASP Professional 11 September 6th, 2004 02:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.