Updating Child Tables

chad101

Member
Joined
Nov 21, 2007
Messages
10
Programming Experience
3-5
How do you display, add, insert, and update a child table which has its fields displayed in text boxes on the same forum as the parent table?

I don’t want to use a datagrid for the child table. Everything is correctly bound to their respective tables. If I attempt to update the child table, it only works if I’m on the first record in the database.


EDIT:
I’m very new to ADO.NET. I just purchased a copy micorsoft ADO.NET core reference.

I have two tables, Log and Comments

Log:
logID
logDate
customerName

Comments:
commentsID
logID
comments

As you can see tbl Log and Comments have a one to many relationship. Although I treat it as a one to one, i.e. I only allow one comment per logID.

My forum navigation works fine. Comments are displayed for each logID record that holds a comment. The comments are placed in a multi-line textbox; not a datagrid. My only problem is UPDATE, INSERT, and DELETE. I can only perform these query types on the first record on the forum. If I navigate to the next record and attempt to update or insert a new record with comments, my changes are never saved to the database.
 
Last edited:
Read the DW2 link in my signature, section "Displaying Related Data" and also "Saving Related Data"
 
Thank you cjard,

I'm going to complete this tutorial. It calls for VS 2005, I only have 2003. If i encounter any problems with this difference I'll do some searching first before i post a follow up question.

Quick "non related" question - I have a friend who said he was only using "one" data adaptor and dataset for an entire (multi-table) database. Is this possiable? I thought you needed a data adaptor for each table?
 
Ahhh... Yeah, you'll encounter significant difficulties following 2005 advice on 2003. I do normally check that under people's names before I post, sorry I missed it here. There is a page with walkthroughs for 2003 under the DW1 link in my signature.. FOllow that instead, hopefully it contains the requisite info, but an upgrade would do your sanity the world of good
 
Back
Top