示例#1
0
        public List <Resultater> GetFromDatabase()
        {
            List <Resultater> results = new List <Resultater>();

            sqlCom.CommandText = "SELECT * FROM Results;";
            sqlCom.Connection  = sqlCon;
            try
            {
                sqlCon.Open();
                using (SqlDataReader reader = sqlCom.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Resultater result = new Resultater();


                        results.Add(result);
                    }
                }
            }
            catch (SqlException s)
            {
                throw s;
            }
            finally
            {
                sqlCon.Close();
            }
            return(results);
        }
示例#2
0
 public void SendAnswer(Resultater resultat)
 {
     string[] values = new string[] {
         resultat.Q1,
         resultat.Q1Comments,
         resultat.Q2,
         resultat.Q2Comments,
         resultat.Q3,
         resultat.Q3Comments,
         resultat.Q4,
         resultat.Q4Comments,
         resultat.AdditionalComments
     };
     db.InsertIntoDatabase(values);
 }