Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
860
Updating of Child row not working
posted

I have a master detail relationship set up in a  dataset as follows:

 

 

 

ds.Tables[0].TableName =

 

"RATING_SET";

ds.Tables[0].PrimaryKey =

 

new DataColumn[] { ds.Tables[0].Columns["RATING_SET_ID"] };

ds.Tables[1].TableName =

 

"RATINGS";

ds.Tables[1].PrimaryKey =

 

new DataColumn[] { ds.Tables[1].Columns["RATING_SET_ID"], ds.Tables[1].Columns["RANK"] };

ds.Relations.Add (

 

"RATINGS_FK" , ds.Tables[0].Columns["RATING_SET_ID"] , ds.Tables[1].Columns["RATING_SET_ID"] );

The column Rating_Set_id column exists in both bands. Following exception is thrown:

+  InnerException {"ForeignKeyConstraint RATINGS_FK requires the child key values (0) to exist in the parent table."} System.Exception {System.Data.InvalidConstraintException}

Do I have to use a WebHierarchicalDataSource?  What gives?

 

 

  • 8160
    posted

    Hello mdelgado,

    it is not necessarily to use WebHierarchicalDataSource, this can be done with DataSet as you started.

    Please find the attached sample showing how to implement manual crud operations on the parent and child bands.

    Hope this helps

    WHDG_Manual_Crud.zip