Example #1
0
        private static List <Treatment> ExcReader(string comm2Run)
        {
            List <Treatment> ul   = new List <Treatment>();
            SqlConnection    con  = new SqlConnection(strCon);
            SqlCommand       comm = new SqlCommand(comm2Run, con);

            comm.Connection.Open();
            SqlDataReader reader = comm.ExecuteReader();

            while (reader.Read())
            {
                Treatment s = new Treatment(
                    (int)reader["treatmentId"],
                    (string)reader["Treatment_name"],
                    (string)reader["Summary"],
                    (int)reader["Treatment_duration"],
                    (int)reader["Cost"],
                    (int)reader["typeId"],
                    (int)reader["Bussiness_Id"]);
                ul.Add(s);
            }
            comm.Connection.Close();
            return(ul);
        }