I am quering a database and am wondering if there is a way to load the results back into a list. The only way i curerntly know of how to get info from a database is within a datatable. I can always get it into a datatable and then loop through the rows in the datatable and add them to a list. But is there a way to directly get the result of a query into a list? This is my code:
OleDbCommand command= new OleDbCommand("SELECT ID, GRADE, PHONE from database WHERE PHONE=123456", conn);
conn.Open();
dt.Load(command.ExecuteReader());
conn.Close();
The result should be a list entry of the form (id, grade, phone):
61265,95,123456
Thanks