public ArrayList get_testimonials_by_course(Course_elearn course) { SqlConnection conn = new SqlConnection(); ArrayList toReturn_list = new ArrayList(); Testimonial toReturn = null; UserDAO u = new UserDAO(); try { conn = new SqlConnection(); string connstr = ConfigurationManager.ConnectionStrings["DBConnectionString"].ToString(); conn.ConnectionString = connstr; conn.Open(); SqlCommand comm = new SqlCommand(); comm.Connection = conn; comm.CommandText = "select * from Testimonials where courseID=@id"; comm.Parameters.AddWithValue("@id", course.getCourseID()); SqlDataReader dr = comm.ExecuteReader(); while (dr.Read()) { toReturn = new Testimonial(); toReturn.setStaffName((string)dr["staff_name"]); //4 toReturn.set_course_elearn(course); //6 toReturn.setQuote((string)dr["quote"]); toReturn.setUser(u.getUserByID((String)dr["userID"])); toReturn.setID((int)dr["ID"]); toReturn.setTitle((string)dr["title"]); toReturn_list.Add(toReturn); } dr.Close(); } catch (SqlException ex) { throw ex; } finally { conn.Close(); } return(toReturn_list); }