构造函数里面,启动窗口的时候代码是这样cmOrders = (CurrencyManager)BindingContext[person1, "person"];
cmOrders.AddNew();我的窗口上面全是textbox单源绑定,属性里面已经添加了绑定,
然后我点确定更新
cmOrders.EndCurrentEdit(); if (person1.GetChanges() != null)
{
try
{ //SqlDataAdapter
personTableAdapter1.Update(person1);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
person1.RejectChanges();
}
}更新总是出错,好像似乎要我对所有的textbox都进行填值一样,
怎么样可以对数据库里德非null字段不填值也能保证更新不报错?
cmOrders.AddNew();我的窗口上面全是textbox单源绑定,属性里面已经添加了绑定,
然后我点确定更新
cmOrders.EndCurrentEdit(); if (person1.GetChanges() != null)
{
try
{ //SqlDataAdapter
personTableAdapter1.Update(person1);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
person1.RejectChanges();
}
}更新总是出错,好像似乎要我对所有的textbox都进行填值一样,
怎么样可以对数据库里德非null字段不填值也能保证更新不报错?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货