在下面的代码中,"在传递带有已删除行的DataRow集合时,Update需要有效的DeleteCommand".意思?
foreach (DataGridViewRow item in this.dataGridView2.SelectedRows)
{
fuelStopsDataSet1.Tables[0].Rows[item.Index].Delete();
}
this.fuelStopsTableAdapter.Update(this.fuelStopsDataSet1.FuelStops);
Run Code Online (Sandbox Code Playgroud)
您可以在某些情况下自动创建DeleteCommand(从SelectCommand推断).
SqlDataAdapter da = new SqlDataAdapter("...SELECT Statement...", connection);
SqlCommandBuilder cmd_b = new SqlCommandBuilder(da); // this already creates
// the Update- and DeleteCommands for the DA
Run Code Online (Sandbox Code Playgroud)
这是一篇关于它的文章:http:
//msdn.microsoft.com/library/vstudio/tf579hcz.aspx
| 归档时间: |
|
| 查看次数: |
8175 次 |
| 最近记录: |