private void LoadValues() { currBalTextBox.Clear(); CashTextBox.Clear(); BankTextBox.Clear(); con.Open(); cmd = new SqlCommand("SELECT Balance, Cash, Bank FROM SavingsAcct", con); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { string balance = (dr["Balance"].ToString()); currBalTextBox.AppendText(balance + ".00"); string bank = (dr["Bank"].ToString()); BankTextBox.AppendText(bank + ".00"); string cash = (dr["Cash"].ToString()); CashTextBox.AppendText(cash + ".00"); } con.Close(); }
public Savings() { string userName; InitializeComponent(); depositCheckBox.Checked = true; con.Open(); //Select's balance from table for preset cmd = new SqlCommand("SELECT Balance, Cash, Bank FROM SavingsAcct", con); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { string balance = (dr["Balance"].ToString()); currBalTextBox.AppendText(balance + ".00"); beforeBalance = Convert.ToInt32(balance); string bank = (dr["Bank"].ToString()); BankTextBox.AppendText(bank + ".00"); string cash = (dr["Cash"].ToString()); CashTextBox.AppendText(cash + ".00"); } con.Close(); //Gets userName from the Login page and determines if tabPage should be removed userName = Login.userName; if (userName != "nickrench3") { tabControl1.TabPages.Remove(tabPage2); tabControl1.TabPages.Remove(tabPage3); } //Gets the history from the EventLog GetHistory(); //Get Last Updated Date GetLastUpdated(); }