I have a WPF Visual Studio 2010 application with a window containing 2 buttons and a datagrid. I want to modify the values of some row from datagrid and when the "Set"-button is pushed the datagrid should be refreshed. The done changes should be saved only when a the Save button is pressed.
The refreshing works fine, but when I push the "save"-button I receive the following error message:
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.
My code at set button is:
myObjBase selected = this.dataGrid1.SelectedItem as nyObjBase;
myObj ist = new myObj ();
ist.field1= "";
ist.field2 = 22;
selected.myObj.Add(ist);
and for the save button I have:
dataSource.SaveChanges();