1

datagridviewを使用しても何も起こらず、何も変わりませんSubmitChanges()

private void Form1_Load(object sender, EventArgs e)
{
    this.book_infoDataGridView.DataSource = bookstore.book_info;
    BindingSource bds=new BindingSource();
    bds.DataSource = this.bookstore.book_info;
    this.book_infoBindingSource = bds;
    this.book_infobindingNavigator.BindingSource = bds;

}      

private void save_Click(object sender, EventArgs e)
{
   this.book_infoBindingSource.EndEdit();
    bookstore.SubmitChanges();
}
4

1 に答える 1

0

私はあなたが.SubmitChanges()あなたのデータからしようとしていると信じていますDataGridView

    private void save_Click(object sender, EventArgs e)
    {
        using (var bookstoreContext = new yourContext())
        {
            var b = (BookClass)bds.Current;
            var book = bookstoreContext.Products.Single(c => c.BookId == b.BookId); //or .First()
            book.BookName = b.BookName;
            book.BookInfo = b.BookInfo;
            bookstoreContext.SubmitChanges();
        }
    }
于 2013-02-08T07:05:54.873 に答える