Code help?
Anyone who knows C# wanna help a wolf out?
What all of that is supposed to do is query the DB, and then loop through all the data pulled from the DB building Student objects and inserting them into the m_alStudentList ArrayList. I've got functional code almost identical to this about 10 lines up, so I can't figure out where in the Hell I'm screwing up.
public void refreshStudentList()
{
// Student attribute containers
int iID;
string strFirstName;
string strLastName;
string strEmail;
int intTeamID;
Student s = new Student();
// Delete the old student list
//m_alStudentList.Clear();
// Connect to the database
connect();
// Query the database for the list of students
m_comCommand.CommandText = "select * from STUDENT where TEAM_ID = " + ApplicationController.m_tmSelectedTeam.getID();
OleDbDataReader rdrReader = m_comCommand.ExecuteReader();
// Fill the student list with the data from the database
while (rdrReader.Read())
{
// Get/convert course attributes
iID = rdrReader.GetInt32(0);
strFirstName = rdrReader.GetString(1);
strLastName = rdrReader.GetString(2);
strEmail = rdrReader.GetString(3);
intTeamID = rdrReader.GetInt32(4);
s.initialize(iID, strFirstName, strLastName, strEmail, intTeamID);
// Add the course to the list
m_alStudentList.Add(s);
}
// Close the reader object
rdrReader.Close();
// Disconnect from the database
disconnect();
}
What all of that is supposed to do is query the DB, and then loop through all the data pulled from the DB building Student objects and inserting them into the m_alStudentList ArrayList. I've got functional code almost identical to this about 10 lines up, so I can't figure out where in the Hell I'm screwing up.