Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,I want to store elements Like a stack push operation from database to in array variable ,I have tried But it doesn't store elements in array properly.So can anyone suggest me for how to store elements in array my code is..


C#
protected void RelativeFamilyIDFrom(Double RelativeMemberID)
    {
        Double[] allFamily = new Double[10];
        Double id;

        sSQL = "SELECT AF_FamilyID FROM AllFamily";
        sSQL = sSQL + " WHERE AF_MemberID IN('" + RelativeMemberID + "')";

        DS = new DataSet();
        da = new OdbcDataAdapter(sSQL,conn);
        da.Fill(DS);

        ArrayList list = new ArrayList();
        if (DS.Tables.Count > 0)
        {
            if (DS.Tables["table"].Rows.Count > 0)
            {
                for (int i = 0; i < DS.Tables["table"].Rows.Count; i++)
                {
                    allFamily[i] = Convert.ToDouble( DS.Tables["table"].Rows[i]["AF_FamilyID"].ToString());

                    list.Add(allFamily[i]);

                }
            }
        }
    }



if RelativeMemberID=81 and matching AF_FamilyID = 1 and 2 ,then how can i store both these element in array like as a stack
Posted
Updated 15-Feb-14 0:57am
v2

1 solution

If two rows are returned, add both to the array list.
 
Share this answer
 
Comments
SVT02 15-Feb-14 7:04am    
i have tried to store both rows in list.Add(allFamily[i]) But it cant added rows in it,So how to add both rows in arraylist
Abhinav S 15-Feb-14 7:23am    
Dont use the intermediate array addFamily. Directly add to the arraylist
SVT02 15-Feb-14 7:37am    
but it doesn't showing an actual elements when rows directly added to the arra list

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900