So here is the code I currently have, when reading one result from a table works fine,
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
newValue = reader.GetString(0);
newPageID = reader.GetInt32(1);
}
However, the problem comes when there are multiple rows that are being returned. The way I tried to do this was like so,
int counter = 0;
List<Trigger> TriggerValues = new List<Trigger>();
while (reader.Read())
{
TriggerValues.Add(new Trigger(reader.GetString(counter), reader.GetInt32(counter+1)));
counter++;
}
But this does not work, which I think is because reader will only return one row. Is there a simple way to modify what I have here to read in new objects row by row? Thanks.