This is the code snippet.
string query = "SELECT EnrollmentDate, COUNT(*) AS StudentCount "
+ "FROM Person "
+ "WHERE Discriminator = 'Student' "
+ "GROUP BY EnrollmentDate";
IEnumerable<EnrollmentDateGroup> data = db.Database.SqlQuery<EnrollmentDateGroup>(query);
System.IO.File.WriteAllText(@"C:\Users\Admin\Desktop\log.txt", data.ToString()); // or ToList()?
Now from my last line of code, I am getting a file with basically the same text that's there in the query. What I want to be displayed in my text file is the actual data from the database? How do I get that?