Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 15th, 2017, 05:55 PM
Authorized User
Points: 46, Level: 1
Points: 46, Level: 1 Points: 46, Level: 1 Points: 46, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2016
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Default Ch 13 - Try It Out, DetailsView, p450. Id Number.

Hi,
P450: Try It Out - Inserting Data with the DetailsView Control, p450.

Step 7.
I inserted a new genre: Name: Disco, with SortOrder: 10. It inserted ok, except the Id number was 4 digits. I deleted it, tried again, and the same thing. Id number shows with 4 digits: 1003.

Any idea why that happens?

-Thanks!
Reply With Quote
  #2 (permalink)  
Old February 17th, 2017, 09:43 AM
Imar's Avatar
Wrox Author
Points: 71,090, Level: 100
Points: 71,090, Level: 100 Points: 71,090, Level: 100 Points: 71,090, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,935
Thanks: 79
Thanked 1,553 Times in 1,530 Posts
Default

If it is what I think it is, it's pretty common: http://stackoverflow.com/questions/1...0-on-7th-entry

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!
Reply With Quote
  #3 (permalink)  
Old February 21st, 2017, 09:59 PM
Authorized User
Points: 46, Level: 1
Points: 46, Level: 1 Points: 46, Level: 1 Points: 46, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2016
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Default

After you responded, I had gone into SSMS and verified that the identity increment and seed were both still set to 1. I queried the Genre table, and the newly added genre: Disco was listed with an Id of 13, not 1003 as it was in gridview.

Yesterday, I went into SSMS and the PlanetWrox db was not listed in object explorer. I was able to successfully attach it though. Checked that the above settings were still the same, and queried the Genre table. This time the new genre: Disco was not listed. I went into VS, displayed the Genre web page and the newly added genre: Disco is not there anymore either.

So I inserted the new genre: Disco using the Genre web page. The Id displayed in gridview as 1004. I went back into SSMS, queried the Genre table and the newly added genre was listed in the result with an Id of 1004 there as well. It's weird that the first time the Id displayed in gridview as 1003, yet displayed in SSMS as 13. Then this time the Id displayed in both gridview and SSMS as 1004. It seems to be inserting 00 in the middle of the Id value: i.e. 13 becomes 1003, 14 becomes 1004, etc.

Apparently this is not uncommon, as per the link you provided. I've accepted that it's some type of quirk with SQL Server 2012 (and perhaps the interaction with gridview, detailsview or VS?) and can live with that. Will this cause any problems getting through the rest of the book?

-Thanks!
Reply With Quote
  #4 (permalink)  
Old February 22nd, 2017, 03:52 AM
Imar's Avatar
Wrox Author
Points: 71,090, Level: 100
Points: 71,090, Level: 100 Points: 71,090, Level: 100 Points: 71,090, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,935
Thanks: 79
Thanked 1,553 Times in 1,530 Posts
Default

>> It seems to be inserting 00 in the middle of the Id value: i.e. 13 becomes 1003, 14 becomes 1004, etc.

That shouldn't happen. Are you sure you're looking at the same database each time? Maybe you connected to a different database in SSMS?

>> Will this cause any problems getting through the rest of the book?

The jump in IDs won't cause problems. You just need to be aware that your numbers could be different from mine. In general, you shouldn't expect identities to always be exactly sequential. If you need a truly sequential number you can use SQL Server's Sequence functionality. For the primary keys of all the tables in the book that's not needed though.

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!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with DetailsView (Ch. 13) waysgoose BOOK: Beginning ASP.NET 4.5 : in C# and VB 9 August 1st, 2014 06:41 AM
Ch 4 and Ch 13/15 - controls and the DataPager AlanWheeler BOOK: Beginning ASP.NET 4.5 : in C# and VB 3 February 24th, 2014 03:56 PM
Chapter 13 - DetailsView Issue pgrant BOOK: Beginning ASP.NET 4 : in C# and VB 4 April 11th, 2012 06:51 AM
Search ch 13, ch 16 sporik BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 0 October 27th, 2009 04:44 PM
Update DB by passing ID number jonsey Classic ASP Professional 1 April 11th, 2007 07:05 PM



All times are GMT -4. The time now is 08:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.