1 回答

TA貢獻(xiàn)1995條經(jīng)驗(yàn) 獲得超2個(gè)贊
好的,我終于知道發(fā)生了什么事了。通過跟蹤對 DataTable 的更改,我發(fā)現(xiàn)接受 DataRow 級(jí)別的更改會(huì)清除 DataTable 級(jí)別的更改。下面是完美運(yùn)行的最終代碼。
DataTable dataTableSold = dataSetItems.Tables["Table"];
DataRow[] dataRowSold = dataTableSold.Select ( "[" + itemIDColumn + "] = '" + itemID + "'" );
dgvItemsTable.BeginEdit ( false );
dataRowSold[0].BeginEdit ();
dataRowSold[0][salesChannelIDColumn] = salesChannelID;
dataRowSold[0][salePriceColumn] = formSoldItemPopup.SalePrice;
dataRowSold[0][saleDateColumn] = formSoldItemPopup.SaleDate;
dataRowSold[0][expensesColumn] = formSoldItemPopup.Expenses;
dataRowSold[0][expenseTypeColumn] = formSoldItemPopup.ExpenseType;
dataRowSold[0].EndEdit ();
dgvItemsTable.Update ();
UpdateItemsDatabase ();
- 1 回答
- 0 關(guān)注
- 144 瀏覽
添加回答
舉報(bào)