0
我在这里遇到问题,我有一个查询到数据库,我只选择一个表,将它加载到dataSet中并填充DataGridView。从DataGridView更新数据时出错
comm = new SqlCommand("Select * from measurement where [email protected] order by me_date DESC", conn);
comm.Parameters.AddWithValue("@id", this.uId);
daPomiar = new SqlDataAdapter();
daPomiar.SelectCommand = comm;
daPomiar.Fill(dsPomiar, "Pomiary");
dataGridView2.DataSource = dsPomiar;
dataGridView2.DataMember = "Pomiary";
添加到此
SqlCommandBuilder cmdBldr = new SqlCommandBuilder(daPomiar);
然而,当我尝试使用BindingNavigotor更新数据:
private void toolStripButton1_Click(object sender, EventArgs e)
{
SqlCommandBuilder cmdBldr = new SqlCommandBuilder(daPomiar);
daPomiar.Update(dsPomiar, "Pomiary");
}
则有时工作,有时它给了我一个错误:
Dynamic SQL generation is not supported against multiple base tables.
M问题是,为什么会发生。我正在一张桌子上工作,所以我可以使用SqlCommandBuilder(我认为)。那么,错误是不规则的 - 有时会出现错误,有时它会起作用 - 数据在表中更新。
我编辑了自己的冠军。请参阅:“[应该在其标题中包含”标签“](http://meta.stackexchange.com/questions/19190/)”,其中的共识是“不,他们不应该”。 – 2014-12-05 17:53:58