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 5th, 2009, 06: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

It would be a lot easier if you answered some of the questions I am asking. Clearly, something is wrong and only if you help me helping you can we figure this out.

==> Did you regenerate the entire Linq to SQL diagram after you changed the database?

==> Does the record get inserted?

==> Is the Id column the primary key?

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 5th, 2009, 06:34 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>>running it without copying and pasting seems to work.

That seems to suggest a problem with the database or with the LINQ to SQL diagram. So, verify your database is OK and has the right keys and identities. Then regenerate the Linq diagram and try again.

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 5th, 2009, 06:41 AM
Authorized User
 
Join Date: Apr 2009
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default



Imar,
I went back into the database disgrams and they are still there. I looked around for something that says regenerate or something to that affect and couldn't find anything.

In answer to your second question I cannot insert any records through the website as you know because it simply generates the error in question. How else are we to test whether a record gets inserted?

In answer to your last question, yes the Id column is the primary key.

Thanks

Thomas
 
Old July 5th, 2009, 06:58 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I meant to regenerate (recreate) the Linq to SQL diagram.

Delete it, add a new one and drag your tables on the design surface. I think you made changes to the database that the LINQ to SQL diagram is unaware off.

And with checking the records I was trying to find out if the insert succeeded but that afterwards something goes wrong.

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 5th, 2009, 07:37 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:
I went back into the database disgrams and they are still there. I looked around for something that says regenerate or something to that affect and couldn't find anything.
This isn't about the Database Diagrams you create in SQL Server, but about the LINQ to SQL diagrams in VWD you created on page 428 and that you update on page 445. You can delete the entire diagram and recreate it with the instructions on these two pages.

If all else fails, send me a message through the Contact page of my personal web site. I'll reply so you know my e-mail address and then send me a zipped version of the project so I can take a look.

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 August 8th, 2009, 06:14 AM
Authorized User
 
Join Date: Apr 2009
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default Hi there

Just to add info as this might help, I got the same problem, mainly because I changed the ID columns to 'identity' type, and DID NOT recreate the LINQ to SQL diagram. When I did, everything went well. Just double click the .dbml file and remove the diagrams, then drag again and link them. This will definitely work. cheers





Similar Threads
Thread Thread Starter Forum Replies Last Post
Object reference not set to an instance of object iceman90289 ASP.NET 3.5 Basics 1 March 1st, 2009 05:13 AM
Object Reference not set to an instance of object srinivas_chakka ASP.NET 1.0 and 1.1 Professional 0 February 8th, 2006 11:56 AM
Object Reference is Not Set to an Instance of an O blackinwhite General .NET 4 February 1st, 2005 05:42 AM
Object reference not set to an instance... steelman BOOK: ASP.NET Website Programming Problem-Design-Solution 6 May 7th, 2004 02:03 AM





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