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