Home Forums WPF controls Xceed DataGrid for WPF Updating DataSource

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #22458 |

    I am binding the datagrid using collectionview source. After insertion of new row in the datagrid or editing an existing row,how to update the actual datasource(northwind sql table).
    I tried getchanges() on the datatable and tried updating using dataadapter but it is throwing exception. Pls help.

    // Xaml DataGrid
    <xcdg:DataGridControl x:Name=”grid”
    ItemsSource=”{Binding Source={StaticResource sortedEmployees}}”

    //Xaml Sorted Employees collection view source

    <CollectionViewSource x:Key=”sortedEmployees”
    Source=”{Binding Source={x:Static Application.Current},Path=Employees}”>
    <compModel:SortDescription PropertyName=”LastName”/>

    Note: path=Employees. Employees is a public datatable(data from northwind employee database) defined in app.cs.

    //Employees table

    SqlConnection sqlConn = new SqlConnection(sqlconStr);
    DataSet ds = new DataSet();
    SqlDataAdapter sqlAdap = new SqlDataAdapter(“select * from employees”, sqlConn);
    sqlAdap.Fill(ds, “Employees”);


    Imported from legacy forums. Posted by guru rajan (had 2419 views)

    Xceed Support
    Post count: 5658

    Hi Guru,

    To commit the changes on your database you should call the .AcceptChanges() method on your Employees DataTable as follow:


    Imported from legacy forums. Posted by Mohamed [Xceed] (had 602 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.