Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 July 6th, 2009, 10:01 AM
Registered User
 
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 13 - Cannot insert explicit value for identity column in table 'Picture' when

Hello,
I got this error in chapter 13
Cannot insert explicit value for identity column in table 'Picture' when IDENTITY_INSERT is set to OFF.

I used the source code and still got the same error.
Please help!
Thank you,
Hoa
 
Old July 6th, 2009, 10:30 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,

Can you supply more information. For example, page number, Try It Out step, relevant code etc?

Also, how does your Picture table look? Is the Id column a primary key and an identity?

Finally, did you maybe make changes to the database after you created the LINQ to SQL diagram? If that's the case, you need to recreate the diagram.

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!
 
Old July 7th, 2009, 10:57 AM
Registered User
 
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The issue might be because of the Database Diagrams. I couldn't get that to open. When I click on it, it genenrates this message:

"This database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. do you want to make yourself the dbo of this database in order to use database diagramming?"

The I click onto the YES button. It then gave me this message:

"This server does not have one or more of the database objects requried to use database diagramming. Do you wish to create them"?

Then I clicked onto the YES button. Then got this message:

"Could not obtain information about Windows NT group/user: 'HGO\102225', error code 0xea"

Any help or suggestions would be appreciated.
Thank you very much!
Hoa
 
Old July 7th, 2009, 11:48 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Not sure why you're getting that error. Google brings up a number of results, each with a different reason, so maybe you can see what's applicable in your situation:

http://www.google.com/search?hl=en&q...2&aq=f&oq=&aqi=

However, this is probably not relevant for this exercise. You need to recreate the LINQ to SQL diagram; not the database diagram.

Hope this helps,

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!
 
Old July 13th, 2009, 12:42 PM
Registered User
 
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 11 - Page 377 - Try it out: Create a Relationship Between Two tables

Hello,
I went back and do all the Try It Out in chapter 11 because I had skipped it earlier which I thought might be the cause of my issue in Chapter 13.

On Page 377 - Try it Out (Create a relationship between two tables) - item #1: Right-Click the Database Diagrams element and click Add New Diagram....

I got the following:
"This database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. do you want to make yourself the dbo of this database in order to use database diagramming?"

The I click onto the YES button. It then gave me this message:

"This server does not have one or more of the database objects requried to use database diagramming. Do you wish to create them"?

Then I clicked onto the YES button. Then got this message:

"Could not obtain information about Windows NT group/user: 'HGO\102225', error code 0xea"

I did many searches on yahoo, google but found no help in resolving this issue. I aslo double checked to make sure that my account has full access to the folder.

I am stuck on this issue and cannot move on with the rest of the book.
Any help or suggestions would be appreciated.
Thank you,
Hoa
 
Old July 13th, 2009, 01:27 PM
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,

The two prompts you're getting are by design and explained in the steps that guide you through creating the diagram.

The error you get seems to be related to security. It looks like your computer was connected to a domain before (group maybe) but now it can no longer find that domain?

It's a bit difficult for me to figure out remotely, so you either need to provide more information (such as security settings, the account you use to log on, whether the computer is connected to a domain, or was connected to a domain before, what the account is that SQL Services is running under, your OS and so on) or you need to contact Microsoft Support. Express is a supported product so you should be able to call them. and ask for help

Sorry if I can't help much more. It's quite impossible to do that remotely. I find many articles related to the error you're getting on Google but only you can determine if they are applicable to your situation.

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!
 
Old November 6th, 2009, 09:48 AM
Registered User
 
Join Date: Nov 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Solution?

I think that your problem could lie in the Id fields of your Picture and PhotoAlbum tables. Did you by any chance set the Is Identity property to Yes. If so, you should set it to No.
 
Old November 6th, 2009, 09:59 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Did you by any chance set the Is Identity property to Yes. If so, you should set it to No.
Heuh? Why would that be? Both columns (the Id column) should be an identity.

And why would this be related to the error message?

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!
 
Old November 6th, 2009, 10:15 AM
Registered User
 
Join Date: Nov 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default No Solution :)

Ok. It works the first time you enter a record with the id not set as Is Identity once you try to enter another, if fails again because it is trying to enter a duplicate value.

Sorry for the false alarm!

The problem on my pc most definitely concerns the Id. If i force an Id number it will work. If I disable the Is Identity when entering a new photo album and give my own Id any future album additions and picture additions will work. If I leave it to SQL to add the Id the problems start. The assigned Id is not being passed to the code so I am getting a few different errors including the 'Object reference not set to an instance of an object' because of Response.Redirect(string.Format("ManagePhotoAlbum. aspx?PhotoAlbumId={0}", myPhotoAlbum.Id.ToString())); ... If i give an Id it goes through to the picture section and will only add picture data if I force an Id. Any suggestions?

Last edited by markjplatts; November 6th, 2009 at 11:07 AM..
 
Old November 6th, 2009, 12:56 PM
Registered User
 
Join Date: Nov 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Maybe a fix now?

Hi again. I think I have got it now, please let me know if it makes any sense to you.

I have altered the properties for both Ids for PhotoAlbum and Pictures by setting the Auto Generated Value to True on the PlanetWrox.dbml file. Now, I can enter information as in the example.





Similar Threads
Thread Thread Starter Forum Replies Last Post
XML EXPLICIT with text column stevemeyns SQL Server 2005 1 February 7th, 2007 01:09 PM
RETURN IDENTITY AFTER INSERT INTO SECOND TABLE pallone SQL Language 2 August 19th, 2006 05:51 PM
getting identity column from the table g_vamsi_krish SQL Server 2000 1 March 15th, 2006 05:05 PM
Alter a column as identity for table kasanar SQL Server 2000 5 July 6th, 2005 08:44 AM





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