View Single Post
  #5 (permalink)  
Old January 25th, 2009, 01:10 PM
Psyclist Psyclist is offline
Authorized User
Points: 129, Level: 2
Points: 129, Level: 2 Points: 129, Level: 2 Points: 129, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2009
Posts: 32
Thanks: 4
Thanked 0 Times in 0 Posts
Default

OK, thank you Old Pedant and Imar for taking the time to respond. I really appreciate it.

I just tried it again.

Quote:
Originally Posted by Imar View Post
Hi Psyclist,

On top of what Old Pedant said, a few things. First, the error message. Does it really say this:
The error message appears in the web page's tab and then there's the lengthy exception error message on the page itself. The one that appears on the tab reads as follows:

"The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Picture_PhotoAlbum". The conflict occurred in database "C:\http://localhost:1497/ManagePhotoAlbum.aspx?PhotoAlbumId=7"

As you can see the "PhotoAlbumId" number increased by one (6 to 7). I checked the data in the table and these Ids do exist.

Quote:
Secondly, can you post your code for the file ManagePhotoAlbum.aspx.cs / ManagePhotoAlbum.aspx.vb? Maybe you're not getting the right ID from the query string?
Here's the ManagePhotoAlbum.aspx.vb page:

PartialClass ManagePhotoAlbum
Inherits BasePage
ProtectedSub LinqDataSource1_Inserting(ByVal sender AsObject, ByVal e As System.Web.UI.WebControls.LinqDataSourceInsertEven tArgs) Handles LinqDataSource1.Inserting
Dim myPicture As Picture = CType(e.NewObject, Picture)
myPicture.PhotoAlbumId = Convert.ToInt32(Request.QueryString.Get(
"PhotoAlbumId"))
EndSub
End
Class

Quote:
Finally, can you define "On the third, I got an exception error". That is, do you get an error when you go to that page the third time, or when you stay on the page when you try to insert a number of pictures in succession?
First, this only happened on the first time I ran the exercise in the browser upon completing it. I created the new album and was taken to ManagePhotoAlbum where I was able to successfully add two photos to that album. Then, when I attempted to add a third to that album, I got the error. On each subsequent attempt to create an album and add pics, I got the error when attempting to add the very first pic to the new album.

One other thing I've noticed that doesn't look right, is in the <LayoutTemplate> element in the ManagePhotoAlbum markup view code, the <ul class="itemContainer"> looks funny in that there's a squiggly line under "itemContainer." Not sure what that means exactly, but I think there's something wrong, potentially.

Thanks, again.