The Problem is .. I have a Set of Lists IDs .. Each one Related to Set of Traffic IDs in the Database ..
I wanna Use One List ID for each loop to get that set of TL IDs and store them in a List but in a Class-seem manner !
when I don't add TL_ids.Clear();
at beginning .. all results are added so the final result becomes = Count of all Traffic lights ids ..
and when I clear before Par.Clear();
all results came back with Zeros .
Any help ?
List<int> TL_ids = new List<int>();
List<string> TL_Desc = new List<string>();
//Array That will Hold Role ID.
ArrayList Par = new ArrayList();
//Get All Traffic Lights info. , but based on Iteration of Lists IDs.
for (int i = 0; i < List_IDs.Count; i++)
{
Par.Clear();
Par.Add(new SqlParameter("@List_id", List_IDs[i].ToString()));
SqlDataReader Dr = GetTLs.ExecSPSelect_dr("GetTLsByListID", Par);
while (Dr.Read())
{
//Fill Intermediate Lists.
TL_ids.Add(int.Parse(Dr[0].ToString()));
TL_Desc.Add(Dr[1].ToString());
}
ALL_TLsBy_Lists.Add(new Lists(List_IDs[i], TL_ids, TL_Desc));
}