This constraint cannot be enabled because not all values have corresponding parent values.

Source: Internet
Author: User
Maybe you are working on ASP. in the ne program, when the dataset master-slave table is nested, this constraint cannot be enabled when filtering the master table, because not all values have the corresponding parent values.

First of all, we need to understand the meaning of this sentence. First, the meaning of this sentence is that the data in the sub-table is not the value associated with each value in the master table.
When we nest two dataset tables, we use an ID to associate the two tables. The statement is as follows: datarelation datasetrelation = Ds. relations. add ("myrela", DS. tables [0]. columns ["caseid"], DS. tables [1]. columns ["caseid"]);

Normally, when the primary table is not filtered, it can be displayed normally. If you delete data from the primary table or filter the primary table, for example, you can set the date of the primary table
When filtering

This constraint cannot be enabled because not all values have corresponding parent values.

Error

This error occurs because the ID table in the sub-table has more values than the ID in the primary table.

The solution is simple.

Datarelation datasetrelation = Ds. relations. add ("myrela", DS. tables [0]. columns ["caseid"], DS. tables [1]. columns ["caseid"], false );

Just add false.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.