Explanation of the dataadapter update method error in Dot Net

Source: Internet
Author: User
Tags dot net

When you use the update method in dataadapter, the following figure shows the error information and analyzes the error by searching the help document. Solution to this problem: first, if your able is a table in the database, it is estimated that you have not set a primary key constraint for this table in the database, you 'd better modify the table in your database and add a primary key constraint, that is, adding a primary key. Second, if selectcommand returns the Outer Join result, dataadapter does not set the primarykey value for the generated able. You must define your own primarykey to ensure that duplicate rows are parsed correctly. The definition method is as follows:

Worktable. primarykey = new datacolumn [] {worktable. columns ["custlname"], worktable. columns ["custfname"]}; // ordatacolumn [] keycolumn = new datacolumn [2]; keycolumn [0] = worktable. columns ["custlname"]; keycolumn [1] = worktable. columns ["custfname"]; worktable. primarykey = keycolumn;

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.