C # This row already belongs to another table

Source: Internet
Author: User

C # This row already belongs to another table

When creating a project, you need to upload the background data to the foreground and display it in the datagrid. Because multiple tables are used for joint query, therefore, the data to be displayed is stored in the DataTable in the background, and then cyclically. Each time a piece of data is found, a piece of data is passed into the DataTable. The logic of the result is adjusted and the code is written, this error is reported:

 

 

After some failed attempts, Baidu was decisive and found the solution. Because it found not only the required data, but also other things, the code should be:

 

Table. Rows. Add (row );

Changed:

Table. Rows. Add (row. ItemArray );

 

After checking, we found that ItemArray represents the data array in this row, and what we need is this, so we only need to get the data we need, however, some people say this is not easy to maintain, and I have not understood it too well. If anyone understands this, please leave a message to me.

 

 

Related Article

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.