public void GetTestTable()
        {
            Globals.adviserList    = new List <Adviser>();
            Globals.cmbAdviserList = new List <Adviser>();

            OpenDB();

            SqlCommand sqlQuery = new SqlCommand();

            sqlQuery.Connection  = dbConn;
            sqlQuery.CommandText = "SELECT * FROM TestTable";

            using (DbDataReader reader = sqlQuery.ExecuteReader())
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int    id   = reader.GetInt32(0);
                        string name = reader.GetString(1);
                        int    pid  = reader.GetInt32(2);

                        Adviser newAdviser = new Adviser(id, name, pid);
                        Globals.adviserList.Add(newAdviser);
                        Globals.cmbAdviserList.Add(newAdviser);
                    }
                    reader.NextResult();
                }
                else
                {
                    Debug.WriteLine("Error : Empty Table");
                }
            }
        }
        private void cmbAdviserList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int     choice = cmbAdviserList.SelectedIndex;
            Adviser adv    = Globals.cmbAdviserList[choice];

            txtID.Text   = adv.id.ToString();
            txtName.Text = adv.name;
            txtPID.Text  = adv.pid.ToString();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DBFunctions dbConn = new DBFunctions();
            int         choice = cmbAdviserList.SelectedIndex;
            Adviser     adv    = Globals.cmbAdviserList[choice];

            adv.name = txtName.Text;
            int.TryParse(txtPID.Text, out adv.pid);
            dbConn.EditTestTableRecord(adv);
        }
        public void EditTestTableRecord(Adviser adv)
        {
            OpenDB();

            SqlCommand sqlQuery = new SqlCommand();

            sqlQuery.Connection  = dbConn;
            sqlQuery.CommandText = "UPDATE TestTable SET colName = '" + adv.name + "', colPID = " + adv.pid + " WHERE id = " + adv.id;
            Debug.WriteLine(sqlQuery.CommandText);
            sqlQuery.ExecuteNonQuery();
        }