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;