how to make changes to database in WPF?
Posted
by user353573
on Stack Overflow
See other posts from Stack Overflow
or by user353573
Published on 2010-06-17T12:38:37Z
Indexed on
2010/06/17
12:43 UTC
Read the original article
Hit count: 257
Drag access database into designer xsd, toolkit:datagrid get datacontext from resources correctly show the table content through this binding. Press button in the button column, can show each row correctly. delete row and add row also work in datagrid
however, when i press button column to add a new row or delete a row, there is no change in the underlying database, how to commit the changes from datagrid to database in WPF if not using ADO.net ?
The following code is what i try do not work
private void datagrid2_delete(object sender, RoutedEventArgs e)
{
Button showButton = (Button)sender;
//person p = (person)showButton.DataContext;
DataRowView ds = (DataRowView)showButton.DataContext;
//DataSet1.customertableRow p = (DataSet1.customertableRow)ds;
//ds.BeginEdit();
//ds.Delete();
//ds.EndEdit();
/*
DataSourceProvider provider = (DataSourceProvider)this.FindResource("Family");
WpfApplication1.DataSet1.customertableDataTable table =
(WpfApplication1.DataSet1.customertableDataTable)provider.Data;
table.AddcustomertableRow("hello3", 5, System.DateTime.Today);
table.AcceptChanges();
}
© Stack Overflow or respective owner