通过ADO.Net实体框架将数据插入SQL Compact时出现问题 [英] Problem when inserting data into SQL Compact by ADO.Net Entity Framework
本文介绍了通过ADO.Net实体框架将数据插入SQL Compact时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DatabaseEntities de = new DatabaseEntities();
Income income = de.Incomes.CreateObject();
income.Id = de.Incomes.Max(f => f.Id) + 1;
income.Person = Users.SelectedValue.ToString();
income.Value = value;
income.Unit = Unit.SelectedValue.ToString();
income.Description = Desc.Text;
de.Incomes.AddObject(income);
de.SaveChanges();
在使用完上述代码段后,我使用了上面的代码段将Income对象插入SQL Compact数据库中下面的语句将数据绑定到DataGridView:
I have used the code section above to insert an Income object into SQL Compact database after that i have used the following statement to bind data to a DataGridView:
IncomeGridView.DataSource = de.Incomes;
我看到了新数据,但是在关闭程序之后,表中没有看到新数据。有人可以向我解释吗?
I saw the new data but after I closed my program I did not see the new data in table. Can anyone explain me?
推荐答案
可能是这样- http://erikej.blogspot.com/2010/05/faq-why-does-my-changes -not-get-saved.html
这篇关于通过ADO.Net实体框架将数据插入SQL Compact时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文