Exemple #1
0
 private void SaveFormulaToList()
 {
     Formula f = new Formula();
     f.title = formulaTitle.Text;
     f.formula = formula.Text;
     for (int i = 0; i < formulaList.Count; ++i )
     {
         if (formulaList[i].title.Equals(f.title))
         {
             formulaList[i] = f;
             return;
         }
     }
     formulaList.Add(f);
 }
Exemple #2
0
 private void LoadFormulaList()
 {
     string sql;
     SqlCommand cmd = new SqlCommand();
     sql = "select * from " + formulaTB + ";";
     cmd.Connection = con;
     cmd.CommandText = sql;
     SqlDataReader reader = cmd.ExecuteReader();
     while (reader.Read())
     {
         Formula f = new Formula();
         f.title = (string)reader["formulaTitle"];
         f.formula = (string)reader["formula"];
         formulaList.Add(f);
     }
     reader.Close();
 }