0
我有一个带有包含2个按钮和一个数据网格的窗口的WPF Visual Studio 2010应用程序。我想修改datagrid中某行的值,当“Set”按钮被按下时,数据网格应该被刷新。只有当按下保存按钮时才应保存完成的更改。使用WPF将数据保存到数据库中
清新的工作正常,但是当我按“保存”按钮上我收到以下错误信息:
System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: String or binary data would be truncated. The statement has been terminated.
我在设定按钮的代码是:
myObjBase selected = this.dataGrid1.SelectedItem as nyObjBase;
myObj ist = new myObj();
ist.field1= "";
ist.field2 = 22;
selected.myObj.Add(ist);
和对于保存按钮我有:
dataSource.SaveChanges();
谢谢!这是问题! – user599977