Results 1 to 2 of 2

Thread: [RESOLVED] ADO.NET - Related DataTables

  1. #1

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Resolved [RESOLVED] ADO.NET - Related DataTables

    I have a dataset with two data tables and a data relation.

    When I fill these tables using a DataAdapter from existing data in the database, I can successfully navigate from a row in my parent table down to the rows in my child table like so:
    VB Code:
    1. drParent.GetChildRows(relParentChild)
    Where drParent is my ParentDataRow and relParentChild is my DataRelation.

    However, when I want to add a new record in each table (that relate to each other) like so:
    VB Code:
    1. drParent = dtParent.NewRow()
    2. drParent.Item("ID") = "TEST Parent"
    3.  
    4. drChild= dtChild.NewRow()
    5. drChild.Item("ID") = "TEST Child"
    6. drChild.Item("ParentID") = "TEST Parent"
    I then try to get to my child rows like so drParent.GetChildRows(relParentChild) but get no rows returned.

    ????

    /Edit: I've tried doing drChild.SetParentRow(drParent , relParentChild) but it doesn't work.
    Last edited by simonm; Mar 2nd, 2006 at 08:26 AM.
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  2. #2

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: [RESOLVED] ADO.NET - Related DataTables

    Doh!

    I forgot to attach my new rows. Once I did that, everything was fine...
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width