protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e) { // Call the base method. base.OnNavigatedFrom(e); // Save changes to the database. db.SubmitChanges(); }
//private List<User> usersList = new List<User>(); public MainPage() { InitializeComponent(); // Connect to the database and instantiate data context. db = new IrishSlangCtx(IrishSlangCtx.DBConnectionString); // Data context and observable collection are children of the main page. this.DataContext = this; User u = new User(); u.name = "Paddy"; u.points = 0; UserTbl tdi = new UserTbl(); tdi.UserName = u.name; tdi.Points = u.points; db.UserTable.InsertOnSubmit(tdi); db.SubmitChanges(); }