我用如下方法更新数据集,
datasetEmp.Tables["sc_indent"].Rows[index][0] = IndentText.Text;
datasetEmp.Tables["sc_indent"].Rows[index][1] = NameText.Text;
datasetEmp.Tables["sc_indent"].Rows[index][2] = NumberText.Text;
datasetEmp.Tables["sc_indent"].Rows[index][3] = Unitcombo.Text;
datasetEmp.Tables["sc_indent"].Rows[index][4] = ClientText.Text;
if (Adapter.Update(datasetEmp.Tables["sc_indent"])>0)
{
datasetEmp.AcceptChanges();
MessageBox.Show("修改成功!", "提示!", MessageBoxButtons.OK,MessageBoxIcon.Information);
}
如上操作更新正常;
但只要接下来再调用
datasetEmp.Reset();
就出现未将对象引用设置到对象的实例的错误提示,这是为什么?
datasetEmp.Tables["sc_indent"].Rows[index][0] = IndentText.Text;
datasetEmp.Tables["sc_indent"].Rows[index][1] = NameText.Text;
datasetEmp.Tables["sc_indent"].Rows[index][2] = NumberText.Text;
datasetEmp.Tables["sc_indent"].Rows[index][3] = Unitcombo.Text;
datasetEmp.Tables["sc_indent"].Rows[index][4] = ClientText.Text;
if (Adapter.Update(datasetEmp.Tables["sc_indent"])>0)
{
datasetEmp.AcceptChanges();
MessageBox.Show("修改成功!", "提示!", MessageBoxButtons.OK,MessageBoxIcon.Information);
}
如上操作更新正常;
但只要接下来再调用
datasetEmp.Reset();
就出现未将对象引用设置到对象的实例的错误提示,这是为什么?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货