开发者

how to make changes to database in WPF?

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();

            /*
            Da开发者_如何学编程taSourceProvider provider = (DataSourceProvider)this.FindResource("Family");
            WpfApplication1.DataSet1.customertableDataTable table =
            (WpfApplication1.DataSet1.customertableDataTable)provider.Data;
            table.AddcustomertableRow("hello3", 5, System.DateTime.Today);
            table.AcceptChanges();
}


Thanks.

Datacontext do not have savechanges options to choose i google that Linq dbml do not support Access and only support MS SQL server that means datacontext.XXXXX can not be used with Access database

At last, i use ADO .Net , OleCommand. It 's the only choice

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜