The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

PaoloTCS (5) [Avatar] Offline
Hello Again,

I have been greatly enjoying your book, but as always, my "need-to-know" is fa ahead of what I have covered so far. So, here is the situation:

I have a ListView with an OnSelecting (OnSelecting="LinqDataSource1_Selecting")

Here is the associated VB:

Dim ArtistID2 As String = Request.QueryString("ArtistID")

Dim ArtByArtist = From Artist In db.Artists _
Join Art In db.Artworks On Artist.ArtistID Equals Art.ArtistID _
Join Media In db.Medias On Art.ArtworkID Equals Media.ArtworkID _
Where Artist.ArtistID = ArtistID2 _
Select FullName = Artist.FirstName & " " & Artist.LastName, Art.ArtworkID, Art.ArtworkName, _
Art.Title, Art.Image, Art.Description, Art.Price, Art.DimensionHeight, Art.DimensionWidth, _
Art.ParentID, Art.ArtistID, zMedia = Media.MediaLocation
e.Result = ArtByArtist

The page is being fed an ArtistID, and the table Artwork data is working fine, I can insert without difficulty. I am having difficulty in trying to fill the related table Media. In the Insert part of the ListView, I can sucesslfully insert all the material in the Artwork table, but it fails on inserts on the Media table. Here is an excerpt from the Insert template:


<asp:TextBox ID="ImageTextBox" runat="server" Text='<%# Bind("Image") %>' />



<asp:TextBox ID="tbzMedia" runat="server" Text='<%# Bind("zMedia") %>' />



Question, How can I insert into the related table? (In the Link to Sql I constructed the relationships).

Thank you, and Merci Bien,