Retrieving rows from childtabel in ado.net 1.1 (net 2003)

Hi again

I'm trying to retrieve the data from a childtable in a relationship like so

For Each row As DataRow In DsSPAM1.Relations(0).ChildTable.Rows
TmpStr += row.Item("NaamGebruiker").ToString.Trim & ": " & _
row.Item("StatusOmschrijving").ToString & vbCrLf
Next

But this gives me all th record and not the records related to the record in the parent table.

tnx and regards

Remco



Answer this question

Retrieving rows from childtabel in ado.net 1.1 (net 2003)

  • Chris Han MSFT

    c'mon guys

    remco


  • Joshua Tipton

    To get child rows for a particular parent row use:

    DataRow.GetChildRows(...)



  • charlie_mtz

    VKH txn got it working. pretty ugly but it works

    stapRow As DataRow
     
    stapRow = CType(Me.BindingContext(DsSPAM1, "Stappen").Current, DataRowView).Row
     
    For Each row As DataRow In stapRow.GetChildRows(DsSPAM1.Relations(0))
     
    TmpStr += row.Item("NaamGebruiker").ToString.Trim & ": " & _
     row.Item("StatusOmschrijving").ToString & vbCrLf
     
    Next
     

    Regards remco

     


  • Retrieving rows from childtabel in ado.net 1.1 (net 2003)