Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Update Parent and Child Table

Update Parent and Child Table

Scheduled Pinned Locked Moved Visual Basic
databasesql-serversysadminhelpannouncement
3 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    EngrImad
    wrote on last edited by
    #1

    Hello every one; the below Code is to update Parent and Child table, the relationship between tables was set to (Relation only) on Data Designer, But on SQL Server, Update and Delete Rule set to (Cascade) with this setup Parent table was Updating ok, but child table return (Added/Modified) changes as nothing and did not get update I tried all cases to Set (Update-Delete-Accept/Reject) relationship Rules On Dataset Designer but did not solve the issue Could advise what to do here thanks in advance

    ParentTableBindingSource.EndEdit
    Dim My_Parent_Modified As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Modified)
    Dim My_Parent_Added As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Added)
    Dim My_Parent_Deleted As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Deleted)

    If My_Parent_ Modified Is Nothing = False Then
    'Some Coding here
    End if
    If My_Parent_ Added Is Nothing = False Then
    'Some Coding here
    End if
    If My_Parent_Deleted Is Nothing = False Then
    'Some Coding here
    End if
    DataSet1.ParentTable.AcceptChanges

    ChildTableBindingSource.EndEdit
    Dim My_Child_Modified As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Modified)
    Dim My_Child_Added As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Added)
    Dim My_Child_Deleted As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Deleted)

    If My_Child_ Modified Is Nothing = False Then
    'Some Coding here
    End if
    If My_Child_ Added Is Nothing = False Then
    'Some Coding here
    End if
    If My_Child_Deleted Is Nothing = False Then
    'Some Coding here
    End if
    DataSet1.ChildTable.AcceptChanges

    Imad

    L 1 Reply Last reply
    0
    • E EngrImad

      Hello every one; the below Code is to update Parent and Child table, the relationship between tables was set to (Relation only) on Data Designer, But on SQL Server, Update and Delete Rule set to (Cascade) with this setup Parent table was Updating ok, but child table return (Added/Modified) changes as nothing and did not get update I tried all cases to Set (Update-Delete-Accept/Reject) relationship Rules On Dataset Designer but did not solve the issue Could advise what to do here thanks in advance

      ParentTableBindingSource.EndEdit
      Dim My_Parent_Modified As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Modified)
      Dim My_Parent_Added As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Added)
      Dim My_Parent_Deleted As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Deleted)

      If My_Parent_ Modified Is Nothing = False Then
      'Some Coding here
      End if
      If My_Parent_ Added Is Nothing = False Then
      'Some Coding here
      End if
      If My_Parent_Deleted Is Nothing = False Then
      'Some Coding here
      End if
      DataSet1.ParentTable.AcceptChanges

      ChildTableBindingSource.EndEdit
      Dim My_Child_Modified As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Modified)
      Dim My_Child_Added As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Added)
      Dim My_Child_Deleted As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Deleted)

      If My_Child_ Modified Is Nothing = False Then
      'Some Coding here
      End if
      If My_Child_ Added Is Nothing = False Then
      'Some Coding here
      End if
      If My_Child_Deleted Is Nothing = False Then
      'Some Coding here
      End if
      DataSet1.ChildTable.AcceptChanges

      Imad

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You already posted this question at Parent and child table update[^]. Please do not repost.

      E 1 Reply Last reply
      0
      • L Lost User

        You already posted this question at Parent and child table update[^]. Please do not repost.

        E Offline
        E Offline
        EngrImad
        wrote on last edited by
        #3

        Sorry Confused already delete fronm there

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups