不可能将第二个 datagridview 的更改保存到数据库!
Anyone seen this? Any suggestions what to do?
private void tableMeLikeBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
try
{
this.Validate();
this.tableMeLikeBindingSource.EndEdit();
// IMPORTANT: the following predefined generic Update command
// does NOT work (sometimes)
// this.tableAdapterManager.UpdateAll(this.rESOURCE_DB_1DataSet);
// instead we explicitely points out the right table adapter and updates
// only the table of interest...
this.tableMeLikeTableAdapter.Update(this.rESOURCE_DB_1DataSet.TableMeLike);
}
catch (Exception ex)
{
myExceptionHandler.HandleExceptions(ex);
}
}
所以免责声明,我对此很陌生,但希望它能帮助其他正在享受尝试新事物的旅程的人。
tablename
Tabledapter、tableAdapterManager 和tablenameBindingNavigator。如果您添加另一个数据网格视图,您会发现第二个数据网格视图缺少它们。
为 Form1 中的两个表添加 datagridview。 private void customersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.customersBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.tempDatabaseDataSet);
}
private void inventoryBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.inventoryBindingSource.EndEdit();
this.tableAdapterManager1.UpdateAll(this.tempDatabaseDataSet);
}
private void Form1_Load(object sender, EventArgs e)
{ this.inventoryTableAdapter.Fill(this.tempDatabaseDataSet.Inventory);
this.customersTableAdapter.Fill(this.tempDatabaseDataSet.Customers);
}