/// <summary> /// Dispose Database Object /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
//查询当前账号的所有记录信息 private void Button_Click_1(object sender, RoutedEventArgs e) { BankEntities1 context = new BankEntities1(); var query = from t in context.MoneyInfo where t.accountNo == txtID.Text select t; if (query.Count() > 0) { datagrid1.ItemsSource = query.ToList(); } else { MessageBox.Show("此账号不存在"); this.txtID.Clear(); } context.Dispose(); }
void Page_Unloaded(object sender, RoutedEventArgs e) { context.Dispose(); }
void DayQuery_Unloaded(object sender, RoutedEventArgs e) { context.Dispose(); }