none
Disabling Dataset Relations RRS feed

  • Question

  • I want to update parent datatable with new Id & same way want to update same to Child Table

     

    I don't want to remove relations which is already exist. Is there any way where i can disable relation & aftewards enable it.

     

    Regards

    Friday, February 29, 2008 12:13 PM

Answers

  •  Manish Joisar wrote:

    I want to update parent datatable with new Id & same way want to update same to Child Table

     

    I don't want to remove relations which is already exist. Is there any way where i can disable relation & aftewards enable it.

     

    Regards

     

    Try this thread for similar situation and what the OP decided to do in that situation.

     

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2559877&SiteID=1

    Saturday, March 1, 2008 6:23 PM
  • Hi, Caddre

     

    DataSet.EnforceConstraints = false

     

    That's what i want.

     

    Thanks

     

    But i do not have to do anything to update PK with new Id of parent table.

    As when i update PK of Parent table it automatically updates new id to child tables.

     

    Regards

    Monday, March 3, 2008 6:05 AM

All replies

  • Hi!

    I didn't really understand your problem. Do you want to change the primary key of an entry and have the change updated in the child table? Or have you bound a datatable to a DataGrid and found that changes made don't use the current relations in the database?

    Relations (as DataRelation objects) exist only in the DataSet object, and reference relations between DataTables that are members of the DataSet. When you fill a DataSet relations are not copied (as far as I know) so you have to either enter them manualy (by adding DataRelation objects) or by extracting them from the Database's XML Schema.

    Sorry if the above doesn't help -

    Upsetian
    Friday, February 29, 2008 12:38 PM
  •  Manish Joisar wrote:

    I want to update parent datatable with new Id & same way want to update same to Child Table

     

    I don't want to remove relations which is already exist. Is there any way where i can disable relation & aftewards enable it.

     

    Regards

     

    Try this thread for similar situation and what the OP decided to do in that situation.

     

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2559877&SiteID=1

    Saturday, March 1, 2008 6:23 PM
  • Hi, Caddre

     

    DataSet.EnforceConstraints = false

     

    That's what i want.

     

    Thanks

     

    But i do not have to do anything to update PK with new Id of parent table.

    As when i update PK of Parent table it automatically updates new id to child tables.

     

    Regards

    Monday, March 3, 2008 6:05 AM